My wife was fasting and forgot that she was. I had sex with her while she was forgetful, but I knew that she was fasting. After we had finished, she remembered that she was fasting, was her fasting valid?
All perfect praise be to Allah, The Lord of the Worlds. I testify that none is worthy of worship except Allah and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and messenger.
If your wife was observing obligatory fasting, making up missed fasts or offering supererogatory fasts after seeking your permission, then it is not permissible for you to invalidate her fasting by having sexual intercourse with her, or otherwise, while you know that she is fasting. As long as you have already done so, you have to repent and seek forgiveness from Allah, The Almighty, for what you have done. However, when she is observing supererogatory fasting without seeking your permission, then you have the right to make her break her fast. Imaam Ash-Shaafi‘i said in Al-Umm:
I have learnt from more than one scholar that if a woman assumes ihram (sacred state) for voluntary Hajj, her husband has the right to prevent her. Also, I have learnt that the Prophet, sallallaahu ‘alayhi wa sallam, said: “It is not permissible for a woman to fast when her husband is present, except with his permission.”
This applies to supererogatory fasting, but not the obligatory one. As long as a wife is not allowed to fast, except after seeking her husband's permission, then he has the right to make her break her fast because she is not allowed to fast without his permission in the first place, and this applies to Hajj as well.
As for your wife, her fasting is valid and there is no sin on her part, nor expiation, because she was forgetful and the Prophet, sallallaahu ‘alayhi wa sallam, said: “Whoever forgetfully eats or drinks, let him complete his fasting, for Allah has provided him with food and drink.” [Al-Bukhari and Muslim]
Muslim scholars regarded the one who forgetfully has sexual intercourse with his wife as the one who forgetfully eats or drinks. This is actually a sound analogy.
Allah Knows best.
You can search for fatwa through many choices