Section: When the person praying enters a town intending to reside therein, he shall not perform any prayer after entering it (25) except the prayer of a resident. If he enters it as a passerby, not intending to reside in it, nor settling in it, or if he settles in it but then departs without the intention of residing for a period that would necessitate him completing the prayer, he shall continue the prayer as he is while traveling. Then, when he stops in it, he shall pray facing the Qiblah and continue from where he left off in his prayer, similar to what we said regarding one who is afraid when he becomes safe during his prayer. If he began it while settled facing the Qiblah and then wished to ride, he shall complete his prayer and then ride. It has been said: He may ride during the prayer and complete it toward the direction of his travel, like one who is safe when he becomes afraid during his prayer. The difference between them is that the state of fear is a state of necessity in which what is needed of action is permitted, while this [walking while praying] is a concession brought about by the Shari'ah without there being a necessity for it; thus, nothing is permitted in it except what has been reported, and no permission has been brought for riding, which requires action and facing a direction other than the Qiblah or the direction of travel, so it remains (26) on the original ruling. And Allah, the Almighty, knows best.
134 - Issue: He said: "And he shall not pray, in other than these two conditions, an obligatory prayer nor a supererogatory prayer, unless facing the Ka'bah; if he is witnessing it, then by being correct, and if he is absent from it, then by ijtihad (independent legal reasoning) to be correct toward its direction."
We have already mentioned that facing the Qiblah is a condition for the validity of the prayer, and there is no difference between the obligatory and the supererogatory prayer; for it is a condition for the prayer, so the obligatory and the supererogatory are equal in it, like purity and covering [the 'awrah]. Furthermore, the statement of the Almighty: "And wherever you are, turn your faces toward it" (24) is general for both of them. Then, if he is witnessing the Ka'bah, his obligation is to pray toward its exact location. We do not know of any disagreement regarding this. Ibn 'Aqil said: If any part of him deviates from being parallel to the Ka'bah, his prayer is not valid. Some of our companions said: People in terms of facing it are of four types: Among them is one for whom certainty is required, and he is the one who is witnessing the Ka'bah, or who is in Makkah and is one of its people, or one who grew up there behind an artificial barrier like walls; his obligation is to turn toward the exact body of the Ka'bah with certainty. And likewise, if he were in the Prophet's Mosque
(25) Omitted from [ms] M. (26) In [ms] M: "fa-yabqa" (so it remains).