1. The Shulchan Arukh (OC 90:4) writes that a person should only daven in a room that has windows that face the direction of Yerushalayim. [It is preferable for the room to have 12 windows, but it’s not necessary for them to all face Yerushalayim]. The Mishnah Berurah explains that this definitely applies to one praying in his home, but is also applies to a shul.
2. The Beit Yosef brings a number of explanations for this law. Rashi’s explanation is that the window exposes the sky, reminding us of our subordination to Heaven.
3. The Mishnah Berurah asks what is the purpose of having windows if one should pray Shemoneh Esrei looking downward and not looking out the window? He explains that if one loses his concentration during Shemoneh Esrei he can momentarily look out the window up at Heaven, remind himself of Hashem and regain his concentration.
4. Rav Akiva Eiger zt”l explains that one should not pray directly in front of the window as this can actually distract you. Rather, one should stand a little bit back from the window so that he can look through it whenever he needs to. Similarly, the Chasam Sofer (27) explains that the common custom is to build the windows higher up, towards the ceiling. in order to avoid people from being distracted by what’s going on outside.
5. It is better to pray in a quiet room without windows than to pray in a room with windows where there are alot of people walking and talking. (Shraga Hameir 6:154)