In a hypothetical conversation, a friend of mine that is atheist asked how a Muslim can find qibla if the salat is performed out from Earth (in the Moon or Mars, by example). Is praying in direction to the Earth is enough?
Disclaimer - I am not a scholar. If you need a scholarly answer to this question, go and talk to someone more appropriate, such as the sheikh at your local masjid.
From either the moon or Mars, the earth is so small in the sky that it is impossible to distinguish facing one point on the earth from facing any other point on the earth. So "facing the earth" is the best you can do, for the Qiblah direction.
At an altitude that varies from 330km to 410 km, the International Space Station is close enough to earth that it is meaningful to ask about the direction of the Qiblah. Malaysian Muslim astronaut Sheikh Muszaphar Shukor was briefly stationed there in 2007. In his words,
“Time for fasting and prayer depends on where you are situated in space. As the space shuttle was launched from Kazakhstan, we took into consideration the local time in Kazakhstan. I prayed five times a day by taking into consideration the time in Kazakhstan. You had to turn your face toward the earth in order to pray in the direction of Mecca. The Space Station was in a position from where you could see the earth directly,”
There is an interesting interview with this astronaut at https://www.facebook.com/note.php?note_id=10150350145901041 and a video of his salah at http://www.youtube.com/watch?v=8rVpxyx8z3g
On the Qiblah direction
This matter has already been discussed long ago by Muslim scholars and the issue actually has a pragmatic solution.
As Allah said:
... So turn your face toward al-Masjid al-Haram. And wherever you [believers] are, turn your faces toward it [in prayer]. .. (2:144)
This actually is the issue as each time you pray you need to face -at least for the beginning of your prayer- the correct direction, which in this case is the actual direction of earth (according both Shi'a and Sunni Scholars). As the Ka'abah or al-Masjid al-Haraam are on earth and facing the actual position of the Ka'abah is rather difficult and therefore a deviation is allowed.
Note that even on earth a deviation from the qiblah is allowed in case of necessity or incertitude. Else I bet most mosques around the world should have been rearranged after the introduction and use of GPS. Actually I know two mosques in the same district in city in Morocco which point to somewhat different qiblah directions I'd assume that the deviation angle is of > 25°, it even happened that people outside the mosque missed the qiblah direction of the mosque by around 45° at Friday's when the mosque is too crowded.
On the prayer times
As for the case of prayer times there's an issue, as for example astronauts staying on the ISS would during 24 h (earth time, as they usually use GMT on the station) face 16 day/night changes.
Some researcher hold the opinion that these people should chose earthly prayer times either of the location they started from or Mekka or based on Greenwich time (as GMT is used on the station) as stated in this article -in Arabic-. He based these opinions on the hadith about the sojourn of ad-Dajjal:
… We said: Allah's Messenger, how long would he stay on the earth? He (ﷺ) said: For forty days, one day like a year and one day like a month and one day like a week and the rest of the days would be like your days. We said: Allah's Messenger, would one day's prayer suffice for the prayers of day equal to one year? Thereupon he (ﷺ) said: No, but you must make an estimate of time (and then observe prayer). …
(See in Sahih Muslim, Jami' at-Tirmidhi and a shorter version in Sunan abi Dawod)
However the only fatwa I found on this topic (see here in Arabic) refers to how to pray in places on earth were days may get too long or too short (see the fatwa here -in Arabic-) namely those locations close to the two poles (north and south pole). This means one should pray according the local time. Which may mean for the example of astronauts on the ISS: praying up to 80 Fard prayer during 24 h. This sounds like hardship to me as they hardly would have time to work.
God never said that praying in another direction than Qibla will make your prayer invalid. If you don't know where to look just pray in any direction, God is everywhere. There is a hadith about that when some people asked the Prophet what to do when there is no sun or stars to locate the East but I can't find it anymore.