* To warn you that the car is still on. If you leave your car running and get out, the car will beep to let you know that it's still on. This is important because if you leave your car running, it could be stolen or it could roll away and cause an accident.
* To let you know that the lights are still on. If you leave your lights on and get out of your car, the car will beep to let you know that the lights are still on. This is important because if you leave your lights on, it could drain your battery.
* To let you know that the door is open. If you leave your door open and get out of your car, the car will beep to let you know that the door is open. This is important because if you leave your door open, it could allow someone to get into your car or it could cause the door to be damaged.
In addition to these reasons, some cars also beep when the door is open and the key is not in the ignition as a way to remind you to take your keys with you.