he is in town, then she must not fast.
The plain sense of the hadith is that a woman may not fast—whether an obligatory fast or a voluntary one—without her husband’s permission. As for a voluntary fast, the ruling is clear: she may not undertake it without his consent, because her husband’s rights are compulsory, whereas a voluntary fast is supererogatory; leaving it brings no sin, but neglecting her husband’s rights does. The husband may at any time wish to enjoy marital intimacy; if she is fasting when he desires that, he will feel constrained. In principle he may still have intercourse with her and thereby invalidate her voluntary fast if he had not earlier approved it, and he would incur no sin. Nonetheless, that situation would trouble him internally, which is why the Prophet (peace be upon him) said: la yaḥillu li-mraʾatin an taṣūma wa-zawjuhā shāhidun illā bi-idhnih (It is not permissible for a woman to fast while her husband is present except with his permission).
As for an obligatory fast, if there is more of the year left than the number of days she must make up, she likewise may not fast without her husband’s permission while he is present. For example, imagine she still owes ten days from Ramadan, it is now Rajab, and she says, “I wish to make up my missed days.” We say: do not begin those make-up fasts without your husband’s consent, because you still have ample time. If, however, only ten days of Shaʿbān remain and he does not allow her to fast, then she may proceed, for it is unlawful for anyone who owes Ramadan fasts to postpone them until the next Ramadan. In that case she is performing a religious obligation, and the husband’s permission—or anyone else’s—is not a condition.
In summary: A woman’s fasting is subject to detail. A voluntary fast is impermissible unless the husband approves. An obligatory fast, when plenty of time remains, is likewise impermissible without his approval; but when the remaining time equals only the days she owes, his permission is no longer required. This applies when