I had sexual intercource with my wife during Ramadhan but we both forgot that it breaks the fast and only remembered at the end. Do I have to do kaffarah? Does this count in forgetfulness? I follow hanafi school of thought
According to the Hanafis having sexual intercourse out of forgetfulness does not invaliate the fast, and hence neither Qada nor Kaffarah are required. This is based on analogy with the hadith of eating\drinking in forgetfulness.
فإن أكل الصائم أو شرب أو جامع ناسيا لم يفطر
If the person who is fasting (ṣā’im) eats, drinks or has sexual intercourse out of forgetfulness, he has not broken his fast.
Note that according to other madhabs this case may require Qada (Maliki) or even Kaffarah (Hanbali).