What is the ruling on having sexual intercourse in a room that is two floors above the mosque, which is on the ground floor of that building?
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.
Before answering your question, it is worth mentioning that once the mosque is built and opened for people to pray in it, it becomes a Waqf (donation) for all Muslims and as soon as the owner of this property no longer possesses it, he is not entitled to take it back, sell it, bequeath it or dispose of it, except for the benefit of the mosque.
However, if the owner at the time of declaring it an endowment set a condition of holding the right to build a room above or beneath his property, Muslim scholars held different opinions in this regard:
The Maaliki School of Fiqh adopted the opinion that building a room or the like beneath it is permissible while building above it is impermissible.
On the other hand, the Hanbali School of Fiqh adopted the opinion that if the owner of that property built a mosque beneath his home, he cannot benefit from the area above the mosque. Whereas, if he built the mosque above his home, he is entitled to make use of the area beneath it.
Moreover, Imaam Abu Yoosuf believed that it is permissible to build above or beneath the mosque.
Apparently, there is no harm in building a room above or beneath the mosque, which is donated as a religious endowment, as long as the owner intended so when he declared it an endowment.
Therefore, this building which is above the mosque is not part of the mosque and thus, does not take the rulings of mosques in Islam, such as: Tahiyyatul Masjid, prohibition of the Junub and the menstruating women from staying in it, shunning selling and buying inside it, avoiding proclaiming lost property, and other relative rulings of mosques in Islam. Furthermore, it is permissible for a married couple who live in this building, which is located above or beneath the mosque, to have sexual intercourse, whether this building was directly above the mosque or above it by two floors or more.
Allaah Knows best.
You can search for fatwa through many choices