It appears that it doesn’t matter as long as you intend to face Mecca, but aren’t there smartphone apps which will direct you to the correct direction based on your location and the fixed location of Mecca? The only problem I see is if you are moving in a car, boat or plane.
Ah, pedantics. If you are on an airplane 35,000 feet up and 7 miles east of Mecca, do you have to be kneeling at a 45-degree angle facing down west, or just flat on the floor?
I would suggest- if the earth is behind the sun, then facing the sun on Mars so your shadow is behind you is correct. If the sun is directly overhead for noon prayers, any direction is equally valid.
After all, when you are on earth, you have to be flat to the ground. You are not required to do headstands in the South Pacific.
You still answer to G-d, Judaism believes in reward and punishment of the soul after death.
And while there’s no Sanhedrin these days, once upon a time (and in the future, after the arrival of the Messiah), sins did (and after the Messiah, will again) carry earthly consequences. (Although failure to pray at all, never mind in the right direction, wouldn’t be one of those things that is punishable by an earthy Sanhedrin at a time of its existence.)
That said, while Jewish prayers are meant to be said facing Jerusalem, they only need to be facing the general direction of Jerusalem, not an exact straight-line route. Most synagogues in America face due east, even though due east of most points in America would be way north of Jerusalem. And if you’re somewhere that you’re unable to determine the proper direction, you can simply pray in any direction and make sure you’re thinking of praying toward Jerusalem.
I don’t know if Islam’s Mecca-orientation has similar allowances, but I figured I’d put the Jewish equivalent out there.