Reference: Fataawa as-Siyaam libni Jibreen – Page 131, Fatwa No.155
Question: Is it permissible for me to take [medical] pills to prevent the start of my menses during the last part of Ramadhaan so that I can complete the remaining days of fasting?
Response: It is permissible to take medication to prevent the start of the menses if the intention is for [doing] righteous actions. So if you intended to fast at its time and pray with the congregation such as the taraaweeh prayer and seek to increase reciting the Qur.aan during the preferred times, then there is no harm in taking [medical] pills for this intention. If the intention is just for fasting so that you do not have any fasts to make up thereafter, then I do not regard this to be good, even if under the circumstances you are rewarded for the fasts.