In general, windows should be installed before drywall. This helps create a stable environment for insulation, electrical, and plumbing work that takes place during construction. Additionally, drywall should not be brought into a structure until it is dry and warm to room temperature (source).