If the fasting person puts anything into his body via the anus, this is one of the things that invalidate the fast according to the majority of scholars.
That includes, for example, inserting his finger, whether that is when cleaning himself after relieving himself, or applying any kind of medicine, or inserting anything such as suppositories or enemas.
A number of scholars have stated that the fast is not invalidated by that. This is the view of Ibn Hazm and is the view favoured by Shaykh al-Islam Ibn Taymiyah and, among contemporary scholars, Shaykh Ibn ‘Uthaymeen (may Allah have mercy on them all).
The reason why it does not invalidate the fast is that there is no evidence to that effect; the basic principle is that it remains valid unless there is evidence to indicate otherwise.
It says in al-Mawsoo‘ah al-Fiqhiyyah (2/87): The Hanafis and Maalikis in their most well-known view, which is also the view of both the Shaafa‘is and the Hanbalis, is that having an enema invalidates the fast of the fasting person and he has to make it up, because ‘Aa’ishah (may Allah be pleased with her) said: The Messenger of Allah (blessings and peace of Allah be upon him) entered upon me and said: “O ‘Aa’ishah, is there any piece of bread?” I brought him a piece and he put it in his mouth, then he said: “O ‘Aa’ishah, did any of it enter my stomach? … This is like the kiss of the fasting person; rather the fast is broken by what goes in, not by what comes out.”
It was narrated from Ibn ‘Abbaas and ‘Ikrimah: The fast is broken by what goes in, not by what comes out. Because this is something that has reached his insides by his choice, it is akin to food, and it has the same effect as breaking the fast, namely providing nourishment to the body. However the Maalikis stipulated that the thing that enters the body should be in liquid form, but none of the other (fuqaha’) made any such stipulation.
According to a lesser known view of the Maalikis, which is also the view of al-Qaadi Husayn among the Shaafa‘is – which was described as odd (shaadhdh) – and is also the view favoured by Ibn Taymiyah, if the fasting person has an enema, it does not invalidate the fast and he does not have to make it up.
They gave as the reason for that the fact that fasting is part of the Muslims’ religion which both scholars and ordinary people need to know about. If these matters were things that Allah, may He be exalted, had forbidden, it would have been incumbent upon the Messenger (blessings and peace of Allah be upon him) to explain that clearly; if he had mentioned it, then the Sahaabah would have known about it and would have conveyed it to the ummah as they conveyed the rest of his rulings. As not one of the scholars transmitted any hadeeth – either saheeh or da‘eef, musnad or mursal – concerning that matter, it is known that he did not say anything about it.
Ibn Hazm (may Allah have mercy on him) said: With regard to enemas, medicine applied to the outer opening of the urethra, and eardrops, they said: Whatever reaches the inside of the body or the inside of the head – because they are regarded as hollow – invalidates the fast, by analogy with food.
Abu Muhammad said: Rather Allah, may He be exalted, forbade us whilst fasting to eat, drink, have intercourse, vomit deliberately or commit sins. We do not know that food or drink could be taken in through the anus, the outer opening of the urethra, or the ear, and we were not forbidden to put things inside our bodies in ways other than eating or drinking that it is not haraam to put inside our bodies. End quote.
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said: With regard to kohl, enemas, medicine applied to the urethral opening, head injuries that reach the brain and deep stab wounds to the body, these are matters concerning which the scholars differed. Some of them said that none of these things break the fast; others said that all of them break the fast except kohl; or that they all break the fast except medicine applied to the urethral opening; or that the fast is not broken by using kohl but all the other things do break the fast.
The most correct view is that none of them break the fast, because fasting is part of the Muslims’ religion which both scholars and ordinary people need to know about. If these matters were things that were forbidden by Allah and His Messenger when fasting, and the fast was invalidated by them, it would have been incumbent upon the Messenger (blessings and peace of Allah be upon him) to explain that clearly; if he had mentioned it, then the Sahaabah would have known about it and would have conveyed it to the ummah as they conveyed the rest of his rulings. As not one of the scholars transmitted any hadeeth – either saheeh or da‘eef, musnad or mursal – concerning that matter, it is known that he did not say anything about it.
End quote from Majmoo‘ al-Fataawa, 25/233
See also: ash-Sharh al-Mumti‘, 6/368; Majallat Majma‘ al-Fiqh al-Islami, 10/638
Based on that, if it is possible for the fasting person to delay what he needs of enemas until after he has broken the fast, that is better, more on the safe side and furthest removed from falling into error, because of what we have mentioned about many of the scholars being of the view that his fast is invalidated by that.
But if that is too difficult for him, or delaying it until after the breaking the fast would cause him harm, and he applies the cream or uses some other remedy, even if that involves inserting what he needs with his finger, then we hope that there will be no blame on him and that his fast will not be invalidated by it. We have quoted above the scholars that favoured this view.
And Allah knows best.