A commodity takes a certain amount of time to produce. This amount of labour time has an equivalent in the form of the commodity that acts as money, historically gold. So with gold acting as money the market price, if sold at it’s value equivalent will be a weight of gold equivalent to the amount of labour time that went into its production. This is the simplifying assumption Marx makes in Volume I of Capital.
Now of course commodities in different industries have different turnover times & different labour-capital intensities; hence Marx’s ‘prices of production’ in Volume III. Still with the simplifying assumption that aggregate prices of production equate with aggregate values, i.e. if prices were set individually at their values.
With supply & demand fluctuations market prices do not even equate with prices of production, unless by accident. But even here we can still say aggregate market prices will equate with their value equivalents.