I'm not sure of the official reason, but I'd imagine it prevents ejections (or worse, partial ejections) from the vehicle.
I was the first person on the scene of a rollover where a woman was pinned underneath the car (fortunately only suffering broken bones) because she was partially ejected through the open window.