Praise be to Allah.
We ask Allaah to heal you and grant you good health, and to keep your spiritual and worldly affairs safe and sound.
It is permissible to take pills to prevent menses in order to be able to do acts of worship such as i’tikaaf, ‘umrah and Hajj, but that is subject to the condition that they should not be harmful to the body. As you are suffering from the disease that you mentioned, you have to consult the doctor before taking these pills, and make sure that they will not conflict with your treatment or cause any harm to you. The Muslim is enjoined to take care of his body and not harm it, because Allaah says (interpretation of the meaning):
“And do not kill yourselves (nor kill one another). Surely, Allaah is Most Merciful to you”
“and do not throw yourselves into destruction”
and the Prophet (peace and blessings of Allaah be upon him) said: “There should be neither causing harm nor reciprocating harm.” Narrated by Ahmad and Ibn Maajah (2341), classed as saheeh by al-Albaani in Saheeh Ibn Maajah.
It says in al-Adaab al-Shar’iyyah (2/463): It is haraam to use as a remedy anything that causes harm. End quote.
Based on this, if these pills are harmful then it is not permissible for you to take them, and you can start i’tikaaf, then if your menses comes then you should leave the mosque and stop i’tikaaf; this is an excuse for you to stop it, and in fact it will be obligatory for you to do so because it is not permissible for a menstruating woman to remain in the mosque.
But if they are not harmful then there is nothing wrong with your taking them.
And Allaah knows best.