In the religion of Islam, the mosque has an important place. It is a place of dhikr, meditation and worshipping; it is also a holy place allocated for begging and praying to Allah. Therefore, it is not appropriate to eat and sleep in the mosque unless there is a necessity. However, it is permissible for strangers to sleep in the mosque.
Therefore, hajjis have a rest and sleep in Masjid al-Haram around the Kaaba and in Masjid an-Nabawi in Madinah today as they did in the past and nobody prevents them.
Some scholars say it is permissible to sleep in mosque for both strangers (guests) and the people living in that area. For instance, Ibn Hajar says,
"It is permissible to sleep in the mosque because Ahl as-Suffa stayed in the mosque all the time."(1)
Some of Salaf as-Salihin say it is makruh to sleep in the mosque for everybody. (2)
1. Mishkat al-Masabih, I/453.
2. al-Fatawa al-Hindiyya, V/321.
(see Halil GÜNENÇ, Günümüz Meselelerine Fetvalar)
Manners in the Mosque:
Allah states the following in the Quran:
"O Children of Adam! Wear your beautiful apparel at every time and place of prayer." (al-A'raf, 7/31)
What is meant by “beautiful apparel” is good manners. The primary goal of the construction of mosques is worshipping Allah. Therefore, deeds like talking so loudly as to disturb the congregation, going to the mosque after eating things whose smell is regarded as bad like onion and garlic, trying to proceed to the first ranks by pushing and shoving people, etc. are not welcomed.
When Hz. Prophet (pbuh) entered the mosque, he would enter with his right foot and pray as follows: "Audhu billahil azimi wa bi wajhihil karimi wa sultanihil qadimi minash-shaytanir-rajim. (I seek refuge in Allah, by His noble face, by His primordial power, from Satan, the outcast.)" It is the Sunnah of the Prophet to perform a two-rak’ah "tahiyyatul-masjid" (greeting the mosque) prayer after entering the mosque. (Ibn Kathir, Tafsir, V / 106)
It is not haram to talk about worldly things in the mosque; it is haram to buy and sell things. It is makruh to talk aloud in mosques. However, a preacher, an imam, and a teacher who is teaching his students can speak up to make themselves heard. It is permissible for those who read the Quran and make dhikr to read aloud unless they disturb those who perform prayers. It is permissible to ask the imam questions in mosques and to learn something from him.
It is regarded makruh to work as a tailor, to repair shoes in the mosque. There are different views about the teachers who teach the Quran and religious knowledge to children by charging money by using the mosque like a school, that is, to use the mosque with this purpose outside the prayer times; it is not makruh according to the majority of the scholars. It is not makruh by the unanimity of the scholars to teach without charging any money.
When some part of a big building or when a floor of an apartment building is used as a mosque, are the decrees about mosques valid for them too?
Ifa floor of an apartment building is used as a mosque and if it is open to the people living in other places in addition to the residents of that apartment building, it becomes subject to the decrees of a mosque. It becomes haram to buy and sell things there, to enter it as junub, etc.
If one of the rooms in a big building or some part of the building is used as a mosque when the building is open but if the mosque is closed when the building is closed, decrees about a mosque are not valid there even if those who go there to perform prayers are not prevented. (Fatawa al-Qadihan – Fatawa al-Hindiyya, l / 110)
(see Celal Yıldırım, Kaynaklarıyla İslam Fıkhı, Uysal Kitabevi: 1/373-374)