When our situation may pray not facing the Qiblah
There are some situations when someone may pray not facing the qibla:
1. When in a state of fear, as in a state of war, this is based on the word of Allah ajja wajalla:
فَإِنْ خِفْتُمْ فَرِجَالًا أَوْ رُكْبَانًا
"If you are in a state of fear (danger), then pray while walking or driving ..." [Al-Baqarah: 239].
2. When the sunnah prayer is above the vehicle, this is based on the hadith of the Prophet sallallaahu alaihi wasallam:
عن جابر رضي الله عنه قال: كان رسول الله صلى الله عليه وسلم يصلي على راحلته حيث توجهت ، فإذا أراد الفريضة نزل فاستقبل القبلة »
From Ibn ‘Umar Radhiyallahu anhuma, he said," The Prophet sallallaahu ‘alaihi wa sallam prayed on his vehicle facing in any direction and when the prayer was required he descended from the vehicle facing the qiblah. (HR: Bukhari no 400).
3. When in conditions of severe pain it is not possible to move facing the qibla and no one is helping him, this is based on the word of God:
لَا يُكَلِّفُ اللَّهُ نَفْسًا إِلَّا وُسْعَهَا ۚ
Meaning: God does not burden someone but according to his ability. (Qs: Al-Baqarah 286).
Source: Fiqh Kotemporer