Facing toward the qiblah whilst praying is a very important matter, because the validity of the prayer depends on it. Hence the scholars, both in the past and present, paid a great deal of attention to ways of determining the qiblah, one of which is the sun.
The qiblah may be determined by means of the sun, by finding out the direction from which it rises and in which it sets; from that it is possible to determine all four directions (east, west, north and south). Then the direction of the qiblah may be determined.
A person who knows that his qiblah is towards the east can face towards the east; a person who knows that his qiblah is towards the north can put the east on his right and face towards the north... and so on.
But this method is only useful for the one who knows the direction of the qiblah in his case, whether it is to the east or west and so on. All he needs to do is to determine the four directions.
See: al-Mughni (2/105).
Contemporary scholars and specialists in astronomy have mentioned a modern method of determining the direction of the qiblah by means of the sun, which is what they call “benefiting from the perpendicularity of the sun over Makkah al-Mukarramah.” The details of this are as follows:
The sun moves to the north and south of the equator in summer and winter. Makkah lies to the north of the equator (between it and the Tropic of Cancer).
What this means is that the sun passes over Makkah twice a year, once when it moves north of the equator and again when it returns. When the time for Zuhr prayer begins according to local time in Makkah, the sun is directly overhead in Makkah, and whoever looks at the sun at that moment will be facing the direction of the qiblah precisely, because at that moment the sun is directly above Makkah.
These two days are 28 May at 9:18 a.m. Greenwich Mean Time (GMT); and 16 July at 9:27 a.m. GMT.
But this phenomenon is only of benefit to the one who sees the sun at that moment; for people in places where it is night at this time, they cannot benefit from this.
But there are two other days when the sun is directly above the place that directly opposite the Ka’bah on the other side of the Earth (i.e., the antipodes of the Ka’bah). They are 28 November at 2109 GMT and 13 January at 2109 GMT.
But the direction of the qiblah is the direct opposite of the direction in which the sun is, so the person should turn his back on the sun, then the direction which is in front of him is the direction of the qiblah.
Thus it is possible for all the people of the earth to determine the direction of the qiblah precisely by means of the sun.