Q. “Is it mandatory, according to Shariah, to complete 40 prayers in Masjid-i-Nabawi when one visit Madinah Munawwarah?”
A. No, it is not mandatory. Even the visit of Madinah Munawwarah is not mandatory, nor is it a part of Hajj.
However, the visit of Madinah is very desirable, its visitor deserves much reward in the Hereafter and the person who can
afford this visit should not make himself devoide of this reward, yet it is not as obligatory as the Hajj itself.
When the visit of Madinah itself is not mandatory how can it be said that performing 40 prayers is mandatory?
However, if somebody can stay in Madinah Munawwarah for at least one week, it is much advisable for him to complete 40 prayers in Masjid-e-Nabawi, because the noble companion Anas ibn Malik (R.A) reports the Holy Prophet ( Sallaho Alaihai Wasallam )
to have said,
“Whoever performs forty prayers in this my masjid, destined for him is the freedom from Fire and redemption from the punishment, and he becomes immune from hypocricy”
This saying of the Holy Prophet ( Sallaho Alaihai Wasallam ) which is held by the scholars of hadith to be authentic, mentions the excellent reward one can enjoy by offering 40 prayers in the Masjid of the Holy Prophet ( Sallaho Alaihai Wasallam ). Therefore, every Muslim who finds an opportunity to stay in Madinah for one week, he should not miss this remarkable gain. But, by no means can it be said that it is mandatory for every visitor of Madinah.