If the car was not heavily damaged and the door hinges are not worn this should be an easy fix by removing the door panel and re-aligning the window.
However, check to make sure that the window rolls up and down easily and doesn't flop around too much. If so, some components may need to be replaced or repaired. Also check to see if the blow-out clips are still located on the weatherstripping along the top of the window. The clips are a "U" shaped plastic covered steel which keep the window from popping out at the top at highway speeds.
If you are purchasing the car the best way to get it fixed would be to have the seller get the windows aligned by a good bodyshop before you purchase the car.