Likewise, if someone vows to pray, fast, give charity, undertake spiritual retreat, offer an Eid sacrifice or a sacrificial offering, or travel to the Prophet’s Mosque—may Allah bless him and grant him peace—or to Jerusalem, the scholars hold two views, both of which are reported from al-Shāfi‘ī.
The first is that he is not obliged to fulfil it. This is the position of Abū Hanīfa and those whose principle is that a vow makes an act obligatory only if religious law already imposes an obligation of the same kind, as with prayer, fasting, and spiritual retreat. Spiritual retreat thus becomes obligatory through a vow because fasting is required according to him, as well as according to Ahmad in one of the two reports from him, and according to Mālik. For this reason, he holds it to be obligatory. Visiting the mosque, however, is not obligatory under religious law, so according to him it does not become obligatory through a vow.
The second view is that a vow to visit the two mosques must be fulfilled. This is the position of Mālik and Ahmad, because doing so is an act of obedience to Allah. The Prophet, may Allah bless him and grant him peace, said:
“Whoever vows to obey Allah, let him obey Him.”
This applies if his intention is to travel to the mosque to pray there, undertake spiritual retreat, or perform similar acts. If, however, his intention is specifically to visit the Prophet’s grave—may Allah bless him and grant him peace—and not to worship in his mosque, he is not to fulfil this vow. Mālik and other scholars explicitly stated this, and there is no disagreement among the imams concerning it, because the Prophet, may Allah bless him and grant him peace, said:
“No journey should be undertaken except to three mosques: the Sacred Mosque, al-Aqsā Mosque, and this mosque of mine.”
Al-Bukhārī and Muslim both related it in their Sahīh collections.