In the context of a very long critique of the Proudhonian idea that commodities should exchange for their exact labor content, Marx comes to this bit in which he contrasts the directly social labor of communal production with the indirectly social labor of commodity production.
“…The communal character of production would make the product into a communal, general product from the outset. The exchange which originally takes place in production — which would not be an exchange of exchange values but of activities, determined by communal needs and communal purposes — would from the outset include the participation of the individual in the communal world of products. On the basis of exchange values, labour is posited as general only through exchange. But on this foundation it would be posited as such before exchange; i.e. the exchange of products would in no way be the medium by which the participation of the individual in general production is mediated. Mediation must, of course, take place. In the first case, which proceeds from the independent production of individuals — no matter how much these independent productions determine and modify each other post festum through their interrelations — mediation takes place through the exchange of commodities, through exchange value and through money; all these are expressions of one and the same relation. In the second case, the presupposition is itself mediated; i.e. a communal production, communality, is presupposed as the basis of production. The labour of the individual is posited from the outset as social labour. Thus, whatever the particular material form of the product he creates or helps to create, what he has bought with his labour is not a specific and particular product, but rather a specific share of the communal production. He therefore has no particular product to exchange. His product is not an exchange value. The product does not first have to be transposed into a particular form in order to attain a general character for the individual. Instead of a division of labour, such as is necessarily created with the exchange of exchange values, there would take place an organization of labour whose consequence would be the participation of the individual in communal consumption. In the first case the social character of production is posited only post festum with the elevation of products to exchange values and the exchange of these exchange values. In the second case the social character of production is presupposed, and participation in the world of products, in consumption, is not mediated by the exchange of mutually independent labours or products of labour. It is mediated, rather, by the social conditions of production within which the individual is active. Those who want to make the labour of the individual directly into money (i.e. his product as well), into realized exchange value, want therefore to determine that labour directly as general labour, i.e. to negate precisely the conditions under which it must be made into money and exchange values, and under which it depends on private exchange. This demand can be satisfied only under conditions where it can no longer be raised. Labour on the basis of exchange values presupposes, precisely, that neither the labour of the individual nor his product are directly general; that the product attains this form only by passing through an objective mediation by means of a form of money distinct from itself.
“On the basis of communal production, the determination of time remains, of course, essential. The less time the society requires to produce wheat, cattle etc., the more time it wins for other production, material or mental. Just as in the case of an individual, the multiplicity of its development, its enjoyment and its activity depends on economization of time. Economy of time, to this all economy ultimately reduces itself. Society likewise has to distribute its time in a purposeful way, in order to achieve a production adequate to its overall needs;just as the individual has to distribute his time correctly in order to achieve knowledge in proper proportions or in order to satisfy the various demands on his activity. Thus, economy of time, along with the planned distribution of labour time among the various branches of production, remains the first economic law on the basis of communal production. It becomes law, there, to an even higher degree. However, this is essentially different from a measurement of exchange values (labour or products) by labour time. The labour of individuals in the same branch of work, and the various kinds of work, are different from one another not only quantitatively but also qualitatively. What does a solely quantitative difference between things presuppose ? The identity of their qualities. Hence, the quantitative measure of labours presupposes the equivalence, the identity of their quality.”
-Marx, Grundrisse 171-172 (Penguin Edition)
This passage is helpful in understanding the categories of directly and indirectly social labor. The labor of individuals engaged in communal production is directly social because the labor does not need to pass through a mediation in order to be part of the social labor of society. Commodity producing labor must produce a product that people want at the socially necessary labor time in order to be considered social labor. All other labor is wasted labor and is not social. Workers in a commodity producing society much purchase their stock of consumption goods with the money they get from selling their labor time. In communal production workers have no product to sell. They do not exchange one product for another. Instead they participate in social consumption to the extent in which they participate in production. Their product is immediately social from the outset because their labor is not only social to the extent in which it measures up to the social average. To say that a worker participates in social consumption to the extent to which they participate in production means that an hour of work earns one an hour of consumption goods, regardless of the efficiency at which one works. This same idea is repeated in the Critique of the Gotha Program and in the fetishism section of chapter one of Capital.