This is more of an elaboration of The Almighty Bob's answer:
It is true that if we start from a competitive market (i.e. large numbers of buyers and sellers), then granting market power to sellers (e.g. workers) by allowing the formation of a monopolistic cartel is bad for efficiency. Those sellers will use their market power to increase the price (and reduce the quantity traded), resulting in a deadweight loss. Thus, we tend to look suspiciously upon practices that create market power. Note that here, the policy intervention we have in mind is to break up the cartel and return us to a competitive world.
Why should the labour market be viewed differently? Part of the answer is that the relevant counterfactual has changed. Begin with a world without labour unions. The market will then typically not be competitive because there are often a small number of employers who themselves enjoy market power. Just as a monopolist seller can drive up the price, these monopolistic (or oligopolistic) buyers of labour can use their power to drive down the price.
Now we are faced with the following policy problem:
How can we correct for employers' market power and restore wages toward the (higher) efficient level?
Two simple solutions come immediately to mind:
Reduce employer's market power by stimulating competition between employers. This is achieved, to some extent, by antitrust policy. But it's hard to do much more here short of forcing more businesses to hire more workers.
Allow workers to form unions so that both workers and employers have market power. If the firms try to use their power to drive wages down and the workers use it to drive them up then there is a sense in which the two will 'cancel out' and the result can be closer to the efficient wage than a market in which only employers have market power.
Whether the second solution indeed works or not depends upon a whole range of factors. Here are a few:
- If the employer side of the market is, in fact, quite competitive then the correction will likely be too big and we will end up with wages that are inefficiently high.
- If bargaining is very costly then it might be more efficient to have one side (e.g. the employers) unilaterally set the wage.
- If there is uncertainty about the wage that firms are willing to pay/workers are willing to accept then bargaining may inefficiently break down (see the Myerson-Satterthwaite Theorem).