Please contribute generously in order to ensure the continuity of our website InshaAllah.
If a person enters the Masjid during one of the times when making prayer is makruh (e.g. sunrise, sunset, zawal,...), does he still have to pray two rak`ahs of Tahiyyat Al-masjid?
Praise be to Allah.
There are differences among the scholars concerning this matter. The correct opinion is that Tahiyyat al-masjid is permitted at all times, even after Fajr and after ‘Asr, because of the general applicability of the hadith “When any one of you enters the Mosque, he should not sit down until he has prayed two rak`ahs.” (Sahih – agreed upon)
Tahiyyat al-masjid is one of the prayers that is done for a specific reason, like Salat al-Tawaf (prayer done after circumambulating the Ka`bah) and Salat al-Kusuf (prayer at the time of an eclipse). The correct view concerning all of these is that it is permissible to do these at times when prayer is generally disallowed, like making up missed prayers.
Concerning Salat al-Tawaf, the Prophet (peace and blessings of Allah be upon him) said: “O Banu ‘Abd Manaf, do not prevent anyone from circumambulating this House and praying at any time of night or day.” (Reported by Imam Ahmad and the authors of Sunan with a sahih isnad)
Concerning Salat al-Kusuf , he (peace and blessings of Allah be upon him) said: “The sun and moon are two of the Signs of Allah; they are not eclipsed because of the death or life of anyone.” (1/332)
For more, please see these answers: 11960 , 5266 , and 21206 .
And Allah knows best.