Kaffara becomes obligatory if the fast was invalidated by:
1- eating, drinking
2- having sexual intercourse
4- remaining in the state of janābah (1) until the time of Fajr (2) prayer.
This is in case that the person fasting commits one of the aforementioned nullifiers intentionally, voluntarily, and with the knowledge that they invalidate his fasting. Thus, if the person was compelled and forced to do the mentioned actions, or preformed them with certainty that it would not invalidate one’s fasting, Kaffara is not obligatory. Also, if someone invalidates their fasting by means other than those mentioned, the recommended precaution is that they should also give a Kaffara.
What is the Kaffara of nullifying a fast?
The Kaffara for breaking a fast (ifṭār) unlawfully in the month of Ramadan is that the person must free a slave, or fast for two months consecutively with the instructions that will be mentioned in the next ruling, or feed sixty poor people (fuqarāʾ) or give each one of them a mudd – which is approximately 750 grams – of food, (i.e., wheat, barley, bread, or such like).
In case that a person was unable to perform the Kaffara, they must give charity to the extent that they can. If this is not possible either, they must seek forgiveness from Allah; and the obligatory precaution is to give the Kaffara whenever they are able to.
(1) A state of major ritual impurity.