All perfect praise be to Allah the Lord of the Worlds. May His peace and blessings be upon our Prophet Mohammad and upon all his family and companions.
The vow is a commitment to a non-mandatory act of worship in Islam. If the vow is made, fulfilling it becomes obligatory, as indicated by the saying of Allah {What means}, "Then let them complete the rites prescribed for them, perform their vows, and (again) circumambulate the Ancient House." {Al-Hajj: 29}, and the statement of the Prophet Mohammad (peace be upon him): "Whoever vows to obey Allah, let him obey Him, and whoever vows to disobey Him, let him not disobey Him" (Narrated by Bukhari).
The scholars have differed regarding the permissibility of fulfilling a vow contingent upon a condition before the realization of that condition. There are various opinions on this matter:
The Shafi'i scholars differentiate between financial vows and physical vows. They permit advancing the fulfillment of a contingent financial vow but not a physical one. Sheikh al-Islam Zakariya al-Ansari, may Allah have mercy on him, stated: "It is permissible to advance the fulfillment of a financial vow over the vow related to the self, such as vowing to free a slave if cured, or to give charity in a certain amount as in expediting the payment of Zakat. This is in contrast to physical vows like fasting" [Asna al-Matalib, Vol. 4/P. 246].
Hajj and Umrah are considered physical vows, and according to the Shafi'i school, it is not permissible to advance their fulfillment over the specified time for the person who made the vow. This is because the analogy for bodily worship is that it should not be performed before its obligatory time. However, the permissibility of appointing someone else to perform Hajj or Umrah on behalf of the one obligated is allowed in cases of necessity. For more details, kindly check [Nihayat al-Matlab Vol. 11/P. 187] by Imam al-Haramayn al-Juwayni.
On the other hand, the Hanafi scholars hold the opinion that if a vow is contingent upon a condition, and it is fulfilled before the occurrence of the specified condition, it is considered a voluntary act (nafil) and, therefore, should be repeated after the condition is met.
Imam al-Sharnabilali, may Allah have mercy on him, said: "If a person makes a vow contingent upon a condition, such as saying, 'If Zaid comes, I am obliged to give charity in a certain amount,' what he did before the occurrence of the condition does not fulfill the vow for him. This is because the vow is contingent upon the condition, and it does not exist before the condition occurs. The fulfillment is only valid after the condition, which was the reason for the vow, has been met" [Maraqi al-Falah, p. 264].
The Hanbali scholars, on the other hand, hold the opinion that it is permissible to fulfill a vow contingent upon a condition before the occurrence of that condition. Imam al-Buhuti, a Hanbali scholar, said: "It is permissible to fulfill the vow before the occurrence of its condition, such as paying expiation after taking an oath but before breaking it." [Kashaf al-Qina' 'an Matn al-Iqna',Vol. 6/P. 277].
In conclusion, to be on the safe side, it is advisable for the one who has made a vow to wait until the condition is fulfilled before fulfilling the vow to be cleared from liability before Allah, and this is adopted by scholarly consensus. However, if he has already fulfilled the vow before the condition is met, and it is difficult or impossible for him to retract it, there is no objection to rule that he is cleared from liability before Allah, based on the view of the Hanbali school of thought. And Allah the Almighty knows best.