Question: If someone is on the roof of the Kaaba at sunset, how should they pray so that the prayer does not become missed?
The teacher’s answer: 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 a case of necessity.
But how could someone become trapped on the roof of the Kaaba and have no choice but to stay there?
What an extraordinary state of affairs!
It seems that, since one must pray facing forward, a person on the roof may pray facing any of its sides.
But if they are on scaffolding outside the roof, they must turn to face one of its sides.