There are certain occasions when fast becomes unlawful; these are:
1) Fasting the first day of the month of Shawwal (Eidul-Fitr).
2) Fasting the tenth day of the month of Thul-Hijjah (Eidul-Adha).
3) Fasting the eleventh and twelfth of Thul-Hijjh by anyone, pilgrim or non-pilgrim, who is then present at Mina.
4) Fast which is not required, such as that of the sick, the woman during her menstrual or post-natal (after having delivered) period, or fasting for a transgression committed (such as fasting to thank Allah for having been able to kill another Muslim), and the fast of one on a journey except if such person seeks the fulfillment of a dear and lawful worldly wish and goes to visit the Prophet's shrine in Medina.
5) Fasting with the intention to prolong his fast till beyond sunset.
6) Fast of silence with the intention of hoping to seek nearness to Allah. Such fast was granted to a few holy men and women after the latter sought and obtained permission from the Almighty such as the case of Zakariyya (as) and Maryam mother of Jesus (as).
7) The fast of doubt: if one is not sure whether the day he is fasting is part of the month of Sha’ban or that of the month of Ramadhan.
8) The fast of a wife who deliberately goes against her husband's wish not to fast.
Some Muslims, particularly Shi’as, may disagree with some of these eight items depending on who they follow as their marji’ taqlid. When in doubt, ask your marji’ or his representative, and Allah knows best.