Market failure occurs when the free market fails to allocate resources efficiently, leading to a suboptimal outcome for society. This can happen when there are externalities, public goods, information asymmetries, or other factors that prevent the market from reaching the socially optimal equilibrium.