She vowed to fast for a month if Allaah caused her husband to mend his ways
Vows are makrooh in principle, and should not be made, because of the report narrated by al-Bukhaari (6608) and Muslim (1639) that Ibn ‘Umar (may Allaah be pleased with him) said: The Prophet (peace and blessings of Allaah be upon him) forbade vows and said: “They do not avert anything, all they do is get something out of a stingy person.”
Al-Bukhaari (6609) narrated from Abu Hurayrah (may Allaah be pleased with him) that the Prophet (peace and blessings of Allaah be upon him) said: “A vow does not bring the son of Adam anything that I have not decreed for him, but vowing is imposed on him by way of foreordainment. Through vowing I make a miser spend of his wealth.”
Although it is makrooh to make vows, it is obligatory to fulfil a vow to do an act of worship, because the Prophet (peace and blessings of Allaah be upon him) said: “Whoever vows to do some act of worship and obedience to Allaah, then let him do it, and whoever vows to do some sin, let him not do it.” Narrated by al-Bukhaari (6318).
Your saying “If Allaah causes my husband to mend his ways and he becomes knowledgeable I will fast for a month” is a vow to do an act of worship, depending on a condition. When the condition is fulfilled, it becomes obligatory to fulfil the vow. If the condition is not fulfilled, you do not have to do anything.
Ibn Qudaamah (may Allaah have mercy on him) said concerning vows to do acts of worship and righteous deeds: They are of three types, one of which is doing an act of worship in return for a blessing that is attained or a misfortune that is warded off, such as saying, ‘If Allaah heals me, I must fast for a month’. So the act of worship becomes binding although it is not ordinarily binding, such as fasting, prayer, charity and Hajj. This must be fulfilled according to scholarly consensus. End quote from al-Mughni (13/622).
It says in al-Mawsoo’ah al-Fiqhiyyah (12/315): The fuqaha’ are unanimously agreed that it is permissible to make a vow conditional, and it is not obligatory to fulfil it before the condition is fulfilled, because the reason for fulfilling the vow is not present. When the condition is fulfilled, it becomes obligatory to fulfil the vow. End quote.
Thus it is clear that what you have heard is not entirely correct. A vow may make a miser give some of his wealth, but the conditional vow does not have to be fulfilled unless the condition is met.
It would have been better for you, instead of making a vow, to advise your husband and help him and guide him to pray and do good deeds and seek knowledge, and make a lot of du’aa’ for him.
We ask Allaah to help you both to do that which He loves and which pleases Him.
And Allaah knows best.