As far as praying on board means of transportation is concerned, then it is possible to pray there so long as the necessary conditions of prayer are fulfilled, or else one can wait until one gets out of the vehicle. If waiting means that the time for the prayer will pass, then you should pray in the best way that you can. Let us assume, for example, that you are in a car or train where there is no place to pray, you cannot stop and pray at the side of the road, and the time for that prayer is running out. In such a situation, the Muslim should pray in the best way that he can, even if he is sitting in his seat and even if he is not facing the qiblah, because Allaah says (interpretation of the meaning): "So keep your duty to Allaah and fear Him as much as you can…" [al-Taghaabun 64:16], and because the Prophet (peace and blessings of Allaah be upon him) said: "If I have commanded you to do something, do as much of it as you can."
(Reported by al-Bukhaari, al-Fath, no. 7288)
An exception to be above is naafil (supererogatory) prayers offered when riding a camel, which is permissible even if one cannot get down or if one is not facing the qiblah. This is known from the report of Ibn 'Umar, who said: "The Prophet (peace and blessings of Allaah be upon him) used to pray when travelling on his camel, no matter which direction it was facing, and he would gesture with his head to indicate the movements of the night prayer, apart from the obligatory prayers, and he would pray witr on his camel too." (Reported by al-Bukhaari, 945)