Praise be to Allah.
If the time for prayer comes and the plane is still flying, and you are afraid that the time for prayer will end before the plane lands in an airport, then the scholars are agreed that it is obligatory to pray as best as one is able, bowing, prostrating and facing the qiblah as much as you can. Allaah says (interpretation of the meaning):
“So keep your duty to Allaah and fear Him as much as you can”
And the Prophet (peace and blessings of Allaah be upon him) said: “If I command you to do a thing, then do as much of it as you are able.” (Narrated by Muslim, 1337).
But if you know that the plane will land before the time for prayer ends and there will be enough time to do the prayer (after it lands), or if the prayer is one of those that may be joined to another, such as Zuhr which may be joined to ‘Asr, or Maghrib which may be joined to ‘Isha, or it is known that the plane will land before the time for the second prayer ends and that there will be enough time to offer both prayers, then the majority of scholars say that it is permissible to offer the prayers on board the airplane, because it is obligatory to offer the prayers when the time for the prayer begins. But some later Maaliki scholars said that prayer on board the airplane is not valid, because one of the conditions of prayer being valid is that the prayer should be offered on the ground, or on something which is in contact with the ground, such as a vehicle or ship, for example. The Prophet (peace and blessings of Allaah be upon him) said: “The earth has been made a place of prayer for me and a means of purification.” (Narrated by al-Bukhaari in al-Tayammum, 335; Muslim in al-Masaajid, 521).