If someone was on the roof of the Kaaba at sunset, how should they pray so that they do not miss the prayer?
Master Ali Saei’s answer to question no. 132: Most scholars do not consider it permissible to pray on the roof of the Kaaba when one has a choice, but they regard it as unobjectionable in an emergency.
But how could someone be trapped on the roof of the Kaaba and be forced to stay there?
What an extraordinary experience!
The apparent ruling is that, since one must pray facing forward, they may pray facing any side within the area of the roof.
But if they are positioned outside the roof on scaffolding, they must turn to face the sides of the Kaaba.