What happens if someone drives a car to a country (international, Schengen excluded) and suddenly decides to sell/dispose of (e.g. broken) the car there and take a flight back to home? Does he/she (driver, passengers) have to pay a fine at the airport?
I think it will greatly depend on the country. Each country sets the rules independently.
Here in Canada, you could not register a vehicle in this country unless it were legally imported. The temporary importation you would have been permitted when entering Canada by road from the US, or by sea from other countries, would not permit you to sell the vehicle here. Now, of course, if you had a serious accident or mechanical failure, an exception would likely be made. Technically you would have to contact Canada Border Services Agency and declare the vehicle's permanent importation, but to my knowledge there is no process where they are notified if you were simply selling your vehicle to a junkyard to scrap.
Note that foreign vehicles may have limited scrap value if that particular make and model is not sold in the country where you scrap your vehicle. It may only be worth a few dollars for the metal content.
If you simply abandoned the vehicle, you could be identified via its registration and/or VIN (serial number) so this isn't wise. It would be best to sell it to a junkyard or automobile recycler.
If the vehicle is roadworthy and you simply wish to not drive it anymore, you may not have a choice - legally you need to re-export it.