On Pesahim 54b, Rava rules, that, in principle, pregnant women and nursing mothers are obligated to fast on 9 Av; they don't have a categorical exemption simply on account of being pregnant or nursing.
Nonetheless, Ramban, in Torat Ha'adam, Aveilut Yeshanah, writes that a woman for the first thirty days after childbirth or a sick person can eat based on her own feeling that she needs to do so, without a need to consult experts. He argues that unlike on Yom Kippur, where the standard is that one only breaks the fast for danger to life (however broadly defined), on 9 Av the standard for breaking the fast is simply illness. Maharshal (Responsa #53) rejects this distinction, saying that the standard is the same as on Yom Kippur, which means that seven days after the birth, a nursing woman is like anyone else. She can only eat if some sort of assessment is made that she is ill. Bah rejects this and supports Ramban’s more lenient standard.
Shulhan Arukh OH 554:6 rules like Ramban. Rema notes that common practice was for nursing women to apply a Yom Kippur standard, only breaking the fast when they feared there was real danger. But he adds that it is perfectly justified to be lenient like Ramban. Bah reports that the stringent common practice was only in play when the woman no longer felt particularly weak as a result of the birth.
Later authorities argue over the precise meaning of the Shulhan Arukh’s standard. Taz argues it is broadly permissive: Postpartum women are technically exempt from fasting on 9 Av for the 30 days, even though the common practice is to be more stringent. Eliyah Rabbah is more concerned about the Maharshal’s position and recommends sticking with common practice that even a postpartum woman should only eat on 9 Av when she is determined to be sick.
What does this add up to in practice? Mishnah Berurah 554:9 reminds us of the Bah’s description of common practice: women did not fast whenever they still felt particularly weak after giving birth, even after the first week. And he says that any woman in such a state should not fast. He also states that a woman who feels well and decides to fast should not complete the fast if she feels any kind of excessive weakness during the day. Arukh Hashulhan 554:8 is more strident. He says that all discussions of fasting by first-month postpartum women were based in earlier days when people were less pampered and more resilient when fasting. [Read: they ate less, were less pampered and could much more easily handle a 25-hour fast as a result.] But today, all authorities would agree that a woman should never fast within 30 days of childbirth. [His language is חלילה!] A woman who wants to do so should be stopped.
There is very solid opinion behind the notion that a woman in the first month after childbirth need not fast at all, as articulated by the Taz’s understanding of the Shulhan Arukh’s position and as extended by the Arukh Hashulhan. One need not hesitate to rely on this opinion. I am not sure I would go quite as far as Arukh Hashulhan and say that one is forbidden from doing so. It can be difficult to simply write off a fast like this when one has done it your whole adult life. This may be an example of a case that my teacher R. David Bigman has described as קולא שאין הציבור יכול לעמוד בו--"a leniency beyond what (some of) the community can bear." Indeed, Eliyah Rabbah suggests that a postpartum woman, even if she knows she will likely have to break the fast, should fast as many hours as she can. For those for whom that would be important and meaningful, one can follow the Mishnah Berurah’s approach: Have a good meal with lots of liquids right before the fast and at least go to bed without eating. In the morning, one can assess the situation and make a judgment as to how much longer one can fast. But a postpartum woman should certainly err on the side of drinking as soon as she experiences any sort of unusual weakness, because according to many authorities, there is no obligation whatsoever.