There are few things that can invalidate the act of fasting in Islam. The detail as follow:
1-Intentional eating or drinking:
If one eats due to forgetfulness, a mistake, or coercion, then he does not have to make up the day later or perform any expiation. Abu Hurairah reported that the Prophet said: “Whoever forgets he is fasting, and eats or drinks is to complete his fast, as it was Allah who fed him and gave him something to drink.” (Related by the group.)
Commenting on it, At-Tirmidhi says: “Most of the scholars act according to this Hadith. It is the opinion of Sufyan Ath-Thauri, Ash-Shafi’i, Ahmad, and Ishaq.”
Abu Hanifah reported that the Prophet, peace and blessings be upon him, said: “Whoever breaks his fast during Ramadan due to forgetfulness is not to make up the day later or to perform any expiation.” (Related by Ad-Daraqutni, Al-Baihaqi, and Al-Hakim, who says that it is Authentic according to Muslim’s criterion.)
Ibn `Abbas reported that the Prophet, peace and blessings be upon him, said: “Allah will not hold anyone of this nation responsible for what is done in error, forgetfulness or under coercion.” (Related by Ibn Majah, At-Tabarani, and Al-Hakim.)
2-Intentional vomiting:
If one is overcome and vomits unintentionally, he does not have to make up the day later on or offer anything as an expiation. Abu Hurairah reported that the Prophet, peace and blessings be upon him, said: “Whoever is overcome and vomits is not to make up the day. Whoever vomits intentionally must make up the day.” (Related by Ahmad, Abu Dawud, At-Tirmidhi, Ibn Majah, Ibn Hibban, Ad-Daraqutni, and Al-Hakim.) If one vomits unintentionally he is not in need of making up the day, while one who vomits intentionally must make up the day later.
3- The menses and post-childbirth bleeding:
Even if such bleeding begins just before the sunset, the fast of that day is rendered void and the day must be made up. There is a consensus of scholars on this point.
4- Ejaculation of sperm:
Ejaculation voids the fast even if it was just due to kissing, hugging, or masturbation, and the day must be made up. If the ejaculation was due to looking at or thinking about something, then it is like having a wet dream during the day and it, therefore, does not void the fast nor is there any requirement on the person.