The US does, in fact, indirectly check passports for foreigners leaving the country: they have the airlines collect and return the I-94W visa waiver counterfoil that the immigration folks staple inside the passport when stamping it. (I assume that visa holders on a white I-94 got similar treatment. Not sure how it works/will work now that ESTA has entirely replaced the visa waiver cardboard thing; I'll be finding out in February.) The airlines in turn check passports against tickets to ensure that (a) the right person is flying, and (b) they're legal at the destination (so the airline doesn't get fined).
Presumably it gives them a chance to check for over-stayers.
If you don't have the required visas for entry to the destination country the destination country will charge the origin country the cost of sending you back. Apart from the cost it's just a lot less hassle all round if a passport problem is discovered before you actually travel.
I've always wondered why so many counties outside of the US require showing one's passport when leaving the country. Is there a restriction on leaving?