I have read your answers to questions about praying whilst travelling and the direction to be faced when praying whilst travelling. But when we are travelling, sometimes we cannot find any means of determining the qiblah, as in the United States, because it is difficult to find a Muslim to ask him about the direction of the qiblah. I have tried to use the compass but I cannot manage it, yet I tried to use it. Is it permissible to pray facing any direction for fear that we may miss the prayer and to offer the prayer again at another time? We know that Allah has made the entire earth a place of prostration.
Praise be to Allaah.
There is no difference of opinion among the scholars concerning the fact that facing the qiblah is one of the conditions of prayer being valid, and that failing to meet this condition – when one is able to do so – renders the prayer invalid. But there are some cases in which the requirement to face the qiblah is waived. Some of these have been discussed in the answer to question no. 65853.
If the Muslim is in a place where he cannot determine the direction of the qiblah, then he should pray facing the direction which he thinks is most likely to be the direction of the qiblah, and he does not have to repeat the prayer after that. Rather his prayer is valid but he does not have to do anything else.
This is indicated by the hadeeth of Jaabir (may Allah be pleased with him) who said:
We were with the Messenger of Allah (blessings and peace of Allah be upon him) on a march or a campaign, and it became cloudy. We tried to determine the qiblah and differed concerning it, so each man prayed on his own, and one of us marked the direction he faced him so that he could check it later. The following morning we looked and found that we had prayed facing a direction other than the qiblah. We told the Prophet (blessings and peace of Allah be upon him) and he did not instruct us to repeat it, and he said: “Your prayer is valid.”
Narrated by al-Daaraqutni, al-Haakim and al-Bayhaqi; classed as hasan by al-Albaani because of corroborating reports in Irwa’ al-Ghaleel, 291.
Shaykh Ibn Baaz (may Allah have mercy on him) was asked about the ruling on one who prays facing a direction other than the qiblah after trying to work it out.
If the Muslim is on a journey or is in a land where it is not easy for him to find someone who can show him the direction of the qiblah, then his prayer is valid, if he did his best to work out the direction of the qiblah, then realized that he prayed facing the wrong direction.
But if he is in a Muslim country, then his prayer is not valid, because he could have asked someone to show him the direction of the qiblah, or he could have worked out the qiblah by looking at the mosques.
End quote from Majmoo‘ al-Fataawa, 10/420
There are many ways of finding out the direction of the qiblah. If the Muslim is travelling and he knows that he will be in a place where he would not be able to work out the direction of the qiblah and there are no Muslims there whom he can ask, then he should make sure to learn some of the ways in which he can determine the direction of the qiblah. That is very easy nowadays, by means of compasses or some watches that contain a program that shows the direction of the qiblah, either by means of the sun or the moon.
So the Muslim should learn that which will make his prayer valid.
And Allah knows best.