All perfect praise be to Allaah, The Lord of the worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
Scholars unanimously agree that facing the Qiblah is a prerequisite for an obligatory prayer to be valid when one is able to do so. However, the degree of divergence in the case of the Masjid mentioned is large and it is therefore impermissible to pray in it, as one of the prerequisites of prayer is not fulfilled.
On the other hand, facing the Qiblaah is a prerequisite for both obligatory and voluntary prayers unless one is a traveler. It was narrated on the authority of Ibn ‘Umar that he said: "The Messenger of Allaah, sallallaahu ‘alayhi wa sallam, used to offer voluntary prayers on the back of his mount facing any direction and also prayed the Witr prayer on it but never offered the obligatory prayer as such." [Al-Bukhari and Muslim]
Some scholars are of the opinion that one is allowed to shorten prayers when travelling and can perform voluntary prayers on a mount while facing any direction. However, the apparent meaning of the Hadeeth indicates otherwise.