Reference: Fataawa Muhimmah li-Nisaa. al-Ummah – Page 54
Question: There are pills which prevent the [onset of the] menses for women or delay it from its [due] time. Is it permissible to use/take them at the time of hajj only out of fear of it coming on?
Response: It is permissible for a woman to take pills which prevent the [onset of the] menses at the time of hajj out of fear of it coming on. And this is to be done after consulting a specialist doctor [to ensure] for the woman’s safety. And likewise [is the permissibility] in Ramadhaan, if she wishes to fast [all of Ramadhaan] with the people (Muslim community).
And with Allaah lies all success and may Allaah send prayers and salutations upon our Prophet (sal-Allaahu ‘alayhi wa sallam) and his family and his companions.