In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
In this fatwa:
2- If one happens to be in a place where one cannot define the direction of qiblah, one is to try every possible means to know its direction.
3- If it came out later that one prayed in the wrong direction, then one does not need to repeat the Prayer.
In his response to your question, Sheikh Ahmad Kutty, a senior lecturer and Islamic scholar at the Islamic Institute of Toronto, Ontario, Canada, states:
In cases such as the one you have mentioned, if we are unable to find the direction of qiblah, all that we are required to do is simply to make an educated guess based on whatever evidence we can think of, and pray.
If after having prayed, we found out that we prayed in the wrong direction, we don’t need to repeat the Prayer.
Therefore, you need not worry about the validity of your Prayer since you tried to make an educated guess in the given circumstance.
Almighty Allah knows best.
Editor’s note: This fatwa is from Ask the Scholar’s archive and was originally published at an earlier date.