From Sahih Bukhari (Hadith 6626):
Narrated Abu Huraira:Allah's Messenger (ﷺ) said, "Anyone who takes an oath through which his family may be harmed, and insists on keeping it, he surely commits a sin greater (than that of dissolving his oath). He should rather compensate for that oath by making expiation
Reference: Bukhari 6626