Some countries require as many as 4 free pages in your passport, and you either pay a "fine" of several thousand dollars or get refused admission. Other countries don't care (Germany is perhaps the most liberal in that way). Many countries also require up to 6 months remaining validity in the passport. These regulations vary a lot by each country. The airline does face a rather large fine (for Mexico it is USD 10,000 per violation) as well as having to provide return transportation. My limited experience with South African immigration is that they are sticklers (one of their stamps from a prior visit was blurred in my passport as that was how they had stamped it, and despite being irrelevant to my current visit they questioned me for a long time about it). CX probably did your friend a favour by catching this before the flight.