There are these things called computers that store all that information. They are kept up-to-date on your comings and goings.
Ok I've seen the Jamaican immigration folks scan the passport upon arrival. I've never noticed the airline counter or the immigration folks scanning a passport when leaving. Just looking at the picture to make sure it is you.