The Shulhan Aruch (Orah Haim 328:49) speaks of a certain device that was used as a type of suppository, which would be inserted into the body and then removed in order to relieve constipation. Interestingly, using this method of relieving constipation on Shabbat does not violate the prohibition of “Refu’a” (“healing” on Shabbat), and the Shulhan Aruch rules that this may be performed on Shabbat, as long as the device is pulled out gently, such that it does not remove any hairs from the skin.
On the basis of this Halacha, Hacham Ovadia Yosef rules (in Hazon Ovadia, vol. 3, p. 370) that the use of suppositories is entirely permissible on Shabbat, since the suppositories are not removed from inside the body, and instead dissolve inside the body. There is certainly no concern of hair removal, and so suppositories may be used on Shabbat.
The Mishna Berura (Rav Yisrael Meir Kagan of Radin, 1839-1933) addresses in this context the use of an enema– fluids that are inserted in order to remove all waste from the body. In the view of the Mishna Berura, the use an enema constitutes “healing” and is thus forbidden on Shabbat. Hacham Ovadia, however, writes (p. 369) that somebody experiencing considerable discomfort due to constipation may use an enema on Shabbat. He writes that this should preferably be done with a “Shinui” – meaning, in an unusual manner – but if this is not possible, it may be done normally. Hacham Ovadia explains that since there is room to contend that the entire prohibition of “Refu’a” does not apply nowadays, as it was instituted out of concern that people might grind herbs on Shabbat – a concern which is certainly not relevant in modern times – there is room for leniency if a person experiences considerable discomfort.
As mentioned in a previous edition of Daily Halacha, it is permissible to drink prune juice to relieve constipation on Shabbat, because prune juice is a beverage that even healthy people drink, and is not used exclusively as medication. Incidentally, Hacham Ovadia notes that for the same reason, it is permissible to drink coffee on Shabbat as a remedy for a headache, since coffee is commonly drunk as an ordinary beverage.
Summary: It is permissible on Shabbat to use a suppository to relieve constipation. One who requires an enema may use one if he experiences considerable discomfort, though preferably it should be administered with a “Shinui” – meaning, with deviation from the normal method.