Allaah has prescribed fasting in accordance with the highest wisdom.
He has commanded the fasting person to fast in a moderate manner, so he should not harm himself by fasting or consume anything that will invalidate the fast.
Hence the things that invalidate the fast are of two types:
Some of the things that invalidate the fast involve things coming out of the body, such as intercourse, deliberate vomiting, menstruation and cupping. These things that come out of the body weaken it. Hence Allaah has described them as being things that invalidate the fast, so that the fasting person will not combine the weakness that results from fasting with the weakness that results from these things, and thus be harmed by his fast or his fast no longer be moderate.
And some of the things that invalidate the fast involve things entering the body, such as eating and drinking. If the fasting person eats or drinks, he does not achieve the purpose of fasting.
Majmoo’ al-Fataawa, 25/248
Allaah has summed up the things that break the fast in the verse where He says (interpretation of the meaning):
“So now have sexual relations with them and seek that which Allaah has ordained for you (offspring), and eat and drink until the white thread (light) of dawn appears to you distinct from the black thread (darkness of night), then complete your Sawm (fast) till the nightfall”
In this verse Allaah mentions the main things that invalidate the fast, which are eating, drinking and intercourse. The other things that break the fast were mentioned by the Prophet (peace and blessings of Allaah be upon him) in his Sunnah.
There are seven things that break the fast, as follows:
3- Eating and drinking
4- Anything that is regarded as coming under the same heading as eating and drinking
5- Letting blood by means of cupping and the like
6- Vomiting deliberately
7- Menstruation and nifaas
The first of the things that invalidate the fast is: intercourse.
This is the most serious and the most sinful of the things that invalidate the fast.
Whoever has intercourse during the day in Ramadaan deliberately and of his or her own free will, in which the two circumcised parts meet and the tip of the penis disappears in either of the two passages, has invalidated his fast, whether he ejaculates or not. He has to repent, complete that day (i.e., not eat or drink until sunset), make up that day’s fast later on and offer a severe expiation. The evidence for that is the hadeeth narrated by Abu Hurayrah (may Allaah be pleased with him) who said: A man came to the Prophet (peace and blessings of Allaah be upon him) and said, “I am doomed, O Messenger of Allaah!” He said, “Why are you doomed?” He said, “I had intercourse with my wife (during the day) in Ramadaan.” He said, “Can you free a slave?” He said, “No.” He said, “Can you fast for two consecutive months?” He said, “No.” He said, “Can you feed sixty poor persons?” He said, “No.”…
Narrated by al-Bukhaari, 1936; Muslim, 1111.
No expiation is required for any of the things that break the fast apart from intercourse.
The second of the things that invalidate the fast is masturbation.
This means causing ejaculation or climax by using the hand etc.
The evidence that masturbation is one of the things that invalidate the fast is the words of Allaah in the hadeeth qudsi in which He says of the fasting person: “He gives up his food and drink and desire for My sake.” Narrated by al-Bukhaari, 1894; Muslim, 1151. Causing ejaculation comes under the heading of the desire which the fasting person gives up.
Whoever masturbates during the day in Ramadaan has to repent to Allaah and refrain from eating and drinking for the rest of the day, and he has to make up that fast later on.
If he starts to masturbate then stops without ejaculating, he has to repent, but his fast is still valid, and he does not have to make it up later because he did not ejaculate. The fasting person should keep away from everything that provokes desire and shun bad thoughts.
With regard to the emission of madhiy (prostatic fluid), the most correct view is that it does not invalidate the fast.The third of the things that invalidate the fast is eating or drinking
This refers to food or drink reaching the stomach via the mouth.
If anything reaches the stomach via the nose, this is like eating or drinking.
Hence the Prophet (peace and blessings of Allaah be upon him) said: “Snuff up water deeply into the nose (when doing wudoo’), except when you are fasting.” Narrated by al-Tirmidhi, 788. If water reaching the stomach via the nose did not invalidate the fast, the Prophet (peace and blessings of Allaah be upon him) would not have told those who are fasting not to snuff up water deeply into the nose.
The fourth of the things that invalidate the fast is anything that is regarded as coming under the same heading as eating and drinking
This includes two things:
1- Transfusion of blood to one who is fasting – such as if he bleeds heavily and is given a blood transfusion. This invalidates the fast because blood is formed from food and drink.
2- Receiving via a needle (as in the case of a drip) nourishing substances which take the place of food and drink, because this is the same as food and drink. Shaykh Ibn ‘Uthaymeen, Majaalis Shahr Ramadaan, p/ 70.
With regard to injections which do not replace food and drink, rather they are administered for the purpose of medical treatment – such as penicillin or insulin – or are given to energize the body, or for the purpose of vaccinations, these do not affect the fast, whether they are intravenous or intramuscular (injected into a vein or a muscle). Fataawa Muhammad ibn Ibraaheem, 4/189. But to be on the safe side, these injections may be given at night.
Kidney dialysis, in which blood is extracted, cleaned and then returned to the body with the additional of chemical substances such as sugars and salts etc. is regarded as invalidating the fast. Fataawa al-Lajnah al-Daa’imah, 10/19
The fifth of the things that invalidate the fast is letting blood by means of cupping
Because the Prophet (peace and blessings of Allaah be upon him) said: “The cupper and the one for whom cupping is done have both invalidated their fast.” Narrated by Abu Dawood, 2367; classed as saheeh by al-Albaani in Saheeh Abi Dawood, 2047.
Donating blood comes under the same heading as cupping, because it affects the body in the same way.
Based on this, it is not permissible for a person who is fasting to donate blood unless it is essential, in which case it is permissible. In that case the donor has broken his fast and must make up that day later on. Ibn ‘Uthaymeen, Majaalis Shahr Ramadaan, p. 71
If a person suffers a nosebleed, his fast is valid, because that happened involuntarily. Fataawa al-Lajnah al-Daa’imah, 10/264
With regard to bleeding that results from extraction of a tooth, surgery or a blood test etc., that does not invalidate the fast because it is not cupping or something that is similar to cupping, unless it has an effect on the body similar to that of cupping.The sixth of the things that invalidate the fast is vomiting deliberately
Because the Prophet (peace and blessings of Allaah be upon him) said: “Whoever vomits involuntarily does not have to make up the fast, but whoever vomits deliberately let him make up the fast.” Narrated by al-Tirmidhi, 720, classed as saheeh by al-Albaani in Saheeh al-Tirmidhi, 577.
Ibn al-Mundhir said: The scholars are agreed that the fast of one who vomits deliberately is invalidated. Al-Mughni, 4/368.
Whoever vomits deliberately by sticking his finger in his throat, pressing his stomach, deliberately smelling something nasty or persisting in looking at something that makes him vomit, has to make up his fast later on.
If his gorge rises, he should not suppress it, because that will harm him. Majaalis Sharh Ramadaan, Ibn ‘Uthaymeen, p. 71.
The seventh of the things that invalidate the fast is the blood of menses and nifaas
Because the Prophet (peace and blessings of Allaah be upon him) said: “Is it not the case that when she gets her period, she does not pray or fast?” Narrated by al-Bukhaari, 304.
When a woman sees the blood of her period or nifaas (post-partum bleeding), her fast becomes invalid even if that is one moment before sunset.
If a woman feels that her period has started but no blood comes out until after sunset, her fast is still valid.
If the bleeding of a woman who is menstruating or in nifaas ceases at night and she has the intention of fasting, then dawn comes before she does ghusl, the view of all the scholars is that her fast is valid. Al-Fath, 4/148.
It is preferable for a woman to keep to her natural cycle and to accept that which Allaah has decreed for her, and not to take any medicine to prevent her period. She should accept what Allaah has decreed for her of not fasting during her period, and make up those days later on. This is what the Mothers of the Believers and the women of the Salaf used to do. Fataawa al-Lajnah al-Daa’imah, 10/151. In addition, it has been medically proven that these means of preventing menstruation are harmful and many women have suffered menstrual irregularities as a result. If a woman takes pills and her period stops as a result, that is fine, she can fast and her fast is acceptable.
These are things that invalidate the fast. All of them – apart from menses and nifaas – only invalidate the fast if three conditions are met: that the person was aware of the ruling and not ignorant of it; that he did it knowingly and not out of forgetfulness; and that he did it by choice and was not forced to do it.
We should also note some things that do not invalidate the fast:
Enemas, eyedrops, eardrops, tooth extraction and treatment of injuries do not invalidate the fast. Majmoo’ Fataawa Shaykh al-Islam, 25/233; 25/245
Medical tablets that are placed under the tongue to treat asthma attacks etc, so long as you avoid swallowing any residue.
Insertion of anything into the vagina such as pessaries, or a speculum, or the doctor’s fingers for the purpose of medical examination.
Insertion of medical instruments or IUD into the womb.
Anything that enters the urinary tract of a male or female, such as a catheter tube, or medical scopes, or opaque dyes inserted for the purpose of x-rays, or medicine, or a solution to wash the bladder.
Fillings, extractions or cleaning of the teeth, whether with a siwaak or toothbrush, so long as you avoid swallowing anything that reaches the throat.
Rinsing the mouth, gargling, sprays etc. so long as you avoid swallowing anything that reaches the throat.
Oxygen or anaesthetic gases, so long as that does not give the patient any kind of nourishment.
Anything that may enter the body via absorption through the skin, such as creams, poultices, etc.
Insertion of a fine tube via the veins for diagnostic imaging or treatment of the veins of the heart or any part of the body.
Insertion of a scope through the stomach wall to examine the intestines by means of a surgical operation (laparoscopy).
Taking samples from the liver or any other part of the body, so long as that is not accompanied by administration of solutions.
Endoscopy, so long as that is not accompanied by administration of solutions or other substances.
Introduction of any medical instruments or materials to the brain or spinal column.
And Allaah knows best.
See Majaalis Ramadaan by Shaykh Ibn ‘Uthaymeen, and the booklet Sab’oona Mas’alah fi’l-Siyaam.