He made a vow if a certain thing happened and it did not happen; and the punishment for not fulfilling a vow
A vow that is conditional upon a certain thing happening is not binding unless that thing happens, such as if a person vowed to give charity or fast if his sick loved one was healed – he does not have to do anything until the sick person is recovered.
His vow must be fulfilled according to scholarly consensus, because the Prophet (peace and blessings of Allaah be upon him) said: “Whoever vows to obey Allaah, let him obey Him, and whoever vows to disobey Him let him not disobey Him.” Narrated by al-Bukhaari, 6318.
Ibn Qudaamah said concerning vows to do acts of obedience or worship:
“These are of three types, one of which is doing the acts of worship in return for a blessing bestowed or a harm warded off, such as if a person says, ‘If Allaah heals me, then I will fast one month for Allaah.’ So this act of worship becomes binding because it is obligatory in principle in sharee’ah, like fasting, prayer, charity and Hajj, and it is obligatory to fulfil this vow according to scholarly consensus.”
So fulfilling the vow becomes a debt owed by that person until he fulfils it, and if he decided to neglect it then he is a sinner.
There is the fear that if he does not do it, Allaah may punish him by instilling hypocrisy in his heart. Allaah says (interpretation of the meaning):
“And of them are some who made a covenant with Allaah (saying): ‘If He bestowed on us of His Bounty, we will verily, give Sadaqah (Zakaah and voluntary charity in Allaah’s Cause) and will be certainly among those who are righteous.’
Then when He gave them of His Bounty, they became niggardly [refused to pay the Sadaqah (Zakaah or voluntary charity)], and turned away, averse.
So He punished them by putting hypocrisy into their hearts till the Day whereon they shall meet Him, because they broke that (covenant with Allaah) which they had promised to Him and because they used to tell lies.
Know they not that Allaah knows their secret ideas, and their Najwa (secret counsels), and that Allaah is the All-Knower of things unseen”
See question no. (42178)
It should be noted that making vows is makrooh, because of the report narrated by al-Bukhaari (6608) and Muslim (1639) from Ibn ‘Umar (may Allaah be pleased with him) who said: The Prophet (peace and blessings of Allaah be upon him) forbade making vows and said: “They do not change anything, they only make a stingy person give (in charity).”
See also question no. 36800.
And Allaah knows best.