The Messenger of Allah ﷺ said, "Do not make vows, for a vow does not avert anything decreed by fate. It only serves to extract something from the miser."
أن رسول الله ﷺ قال: لا تنذروا، فإن النذر لا يغني من القدر شيئا، وإنما يستخرج به من البخيل.
Muslim narrated it in the Book of Vows (5:1640), from Qutayba bin Saeed, who said, Abdul-Aziz (meaning Darawardi) narrated to us from Ala bin Abdul-Rahman, from his father, from Abu Hurairah, and he related it. Shuba also narrated it, saying, I heard Ala relate it with his chain, but he did not include in it the words, "Do not make vows."As for his saying, "Do not make vows," some scholars have held that this prohibition indicates that vowing is forbidden, because the one who makes a vow may find that what he vowed for is decreed for him, so he comes to think that this happened because of the vow. This would mean his belief is that the vow changes what has been decreed. This is unlike someone who believes that a vow does not change what is decreed, for whom making a vow is merely disliked.Its meaning is, do not make vows thinking that through the vow you will attain something Allah has not decreed for you, or that you will turn away from yourselves something the decree has already determined against you. And if you do this, then discharge it by fulfilling it, for what you have vowed becomes binding upon you.See for more, Sharh al-Sunnah (23/10).