Sayyidah Aisha (may Allah be pleased with her) said: The Messenger of Allah (peace and blessings be upon him) said: “Whoever makes a vow to obey Allah should obey Him, and whoever makes a vow to disobey Allah should not commit the sinful act.”
Hadith Referenceسنن دارمي / من النذور و الايمان / 2375
From this hadith, it is understood that whoever makes a vow (nadhar) in obedience to Allah—such as for prayer (salah), fasting (sawm), pilgrimage (hajj), minor pilgrimage (‘umrah), jihad, etc.—then he should fulfill that vow. And whoever makes a vow to disobey Allah, then he should not commit disobedience to Allah; that is, if he says that he will not pray, or will not keep obligatory fasts, etc., then in such a case, it is not necessary to fulfill that vow. Rather, obedience to Allah is necessary, and he should offer expiation (kaffarah) for his vow, as has been detailed above.