Praise be to Allah.
There is nothing wrong with using this treatment, if it is prescribed for you by a competent doctor.
The scholars (may Allaah have mercy on them) have stated that it is permissible to use an enema as a medical treatment, and some of them did that, such as Abu Yoosuf the companion of Abu Haneefah, and Imam Ahmad (may Allaah have mercy on them). In this case it is permissible to uncover the ‘awrah because there is a need to do so.
Al-Kaasaani said in Badaa’i’ al-Sanaa’i’ (5/128):
There is nothing wrong with enemas because that is a kind of medical treatment, and it is something that is recommended because the Prophet (peace and blessings of Allaah be upon him) said: “Seek medical treatment, O slaves of Allaah, for Allaah does not send down any disease but He also sent down the cure, apart from death and old age.”
Narrated by Ahmad, 17987; Abu Dawood, 3855; classed as saheeh by al-Albaani in Saheeh Abi Dawood, 3264.
Al-Sarkhasi said in al-Mabsoot, 10/156:
With regard to looking at the ‘awrah, that is haraam… but if there is a reason for doing so, there is nothing wrong with looking at the ‘awrah for a necessary purpose. That includes:
When a woman is giving birth, (her attendants) may look at the vagina and other parts of the woman’s body.
Similarly a man may look at the site where an enema is given, when necessary.
In the case of sickness, there is a necessary reason, and an enema is a kind of medical treatment. The Prophet (peace and blessings of Allaah be upon him) said: “Seek medical treatment, O slaves of Allaah, for Allaah does not send down any disease but He also sent down the cure, apart from death and old age.” And it was narrated that Abu Yoosuf suffered from emaciation so it was said to him: An enema will relieve you of the emaciation you are suffering. So there is nothing wrong with showing that area to the person performing the enema. This is correct, because extreme emaciation is a kind of sickness.
Al-Mirdaawi said in his footnote to al-Furoo’ (2/171):
Is it makrooh to have an enema, whether that is necessary or not? Then he said: The correct view is that it is not makrooh, rather it is permissible if there is a need, but it is makrooh if there is no need…. Al-Marroodhi said: It was prescribed for Abu ‘Abd-Allaah – i.e., Imam Ahmad – and he did it, i.e., an enema.
And Allaah knows best.