Question: If a person is fasting during the day of the holy month of Ramadhan and to prevent pregnancy must take pills and because the pills are taken every 12 hours and whatever the plan one of those pills must be taken during the fasting time, what is the ruling about this? If someone breaks fast in this condition, what must the person do?
The Grand Ayatollah Vahid: If getting pregnant is dangerous for the mother and prevention from pregnancy is only by the way of taking pills, then taking pills is allowed. Otherwise, not fasting (breaking fast as mentioned) is Haram, and for every day must feed 60 poor persons, each one for 750 grams, or fast for 60 days and later on fast for those lost days.
source : Shafaqna