Jaber the son of Abdullah said: “The prophet ﷺ used to pray on his camel wherever it turns (in direction) but when he prayed the obligated (Salah) he would step down and face Qiblah.” Hadith narrated by Bukhari
In this Hadith a clear reference to pray (Nafelah) the non-obligated Salah while riding is permissible regardless toward which direction. Imam Nawawi said: “This is permissible by consensus of Muslims.” It is also not necessary to start your Salah toward Qiblah as a condition.
Scholars say that the road itself would become the direction of the traveler while praying. With that in mind, scholars said that it is not permissible to keep moving your head to different directions while praying.
This Hadith did not specify the how the performance of Salah itself is conducted, but in another Hadith through Amer son of Rabee’ah he said: “I saw the prophet ﷺ on his camel praying (nafelah) non-obligated Salah nodding his head toward any direction.” This narration speaks of one type of movement of the head but scholars say that the head would be lower during Sujood than during Ruku’.
People traveling in planes are allowed to pray the obligated Salah even toward the direction of the plane because of safety and necessity.
People driving cars should not pray while driving the car for safety issues, only passengers next to them or in the back seat can do that.
By Sh. Kifah Mustapha