QuestionIs staying in the Masjid for worship during the month of Ramadhan a compulsory Sunnah? What are its conditions in times outside of Ramadhan? Answer
Staying in the Masjid for worship during Ramadhan is Sunnah. The Prophet (Sallallahu Alayhi wa Sallam) did it during his lifetime and his wives did it after his death. The people of knowledge have mentioned that there is a consensus among the scholars that it is Sunnah.
However, staying in the Masjid for worship should be done in the manner that agrees with the purpose for its legislation. This is that the person remains in the Masjid for the obedience of Allah. He does this by leaving off worldly acts for the sake of performing acts of obedience to Allah. He stays far away from his worldly affairs and he does various acts of obedience, such as prayer, remembrance of Allah and other things. The Messenger of Allah (Sallallahu Alayhi wa Sallam) used to stay in the Masjid for worship while seeking the Night of Decree (Laylatul-Qadr). The person who stays in the Masjid for worship avoids worldly deeds. Thus, he does not sell, he does not buy, he does not leave out of the Masjid, he does not follow the funeral procession, and he does not visit the sick person.
In reference to what some of the people do of staying in the Masjid and then some visitors come to visit them during the night and at the ends of the day, and along with that they have forbidden conversations, this contra¬dicts the purpose of staying in the Masjid.
However, if someone visits the person staying in the Masjid from among his family members and they speak with him, there is no harm in that. It has been reported from the Prophet (Sallallahu Alayhi wa Sallam) that Safiyyah (Radhi Allahu Anha) visited him while he was staying in the Masjid and she spoke with him. What is important is that the person make his staying in the Masjid for drawing near to Allah, glory be unto Him, the Most High.
Shaikh Ibn Uthaimin (Rahimahullah)
Reference: Fatawa Islamiyah Volume 3 Page 331