Yes. The MacBook, MacBook Pro, and MacBook Air all have something called Sudden Motion Sensor.
You can read more about this here:
http://en.wikipedia.org/wiki/Sudden_Motion_Sensor
I hope this answers your question. Good luck.