The Shulhan Aruch (Orah Haim 330:4) establishes that for three days after a woman delivers a baby, she is presumed to be in a potentially life-threatening condition, and thus caring for her overrides all the Shabbat prohibitions. This means that if the woman during this period needs food cooked, water heated, or a light turned on or off – this may all be done on her behalf, even if it is Shabbat. Even if the woman says she does not require this care, it is assumed that she is unaware of what her body needs after childbirth, and so everything which people deem necessary for her wellbeing may be done, even at the expense of the Shabbat prohibitions, without any hesitation.
The Mishna Berura (Rav Yisrael Meir Kagan of Radin, 1839-1933) brings two opinions as to how this three-day period is determined. According to one view, this period spans three Halachic days, as determined by sunrise and sunset. Thus, for example, if a woman delivered a baby before sundown on Wednesday, the three-day period consists only of the rest of the Wednesday, and then Thursday and Friday. On Shabbat, she would not be considered in a presumed condition of potential risk. However, the Mishna Berura then brings many other Halachic authorities (including the Ritva, the Eliyahu Rabba, the Issur Ve’heter, and the Bet Efrayim) who maintain that this period spans 72 hours. And therefore, if the delivery occurred before sundown on Wednesday afternoon, the three-day period continues until that time of day on Shabbat afternoon. Until that time, anything needed for the sake of caring for the woman may be done, even at the expense of the Shabbat prohibitions, and even if the woman says she does not need this care. This is the view accepted by Hacham Ovadia Yosef, in several contexts (Yabia Omer, vol. 7, Orah Haim 53; Leviyat Hen, 95; and Hazon Ovadia – Shabbat, vol. 3, p. 333).
After this 72-hour period, but within a week of childbirth, Shabbat may not be violated for needs which the woman says she does not require. Since the level of danger at this point is lower, one may not violate Shabbat for something which the woman says is not necessary. From the Shulhan Aruch’s formulation of this Halacha it appears that it applies only if the woman specifically says she does not need something done for her, but if she says nothing, then Shabbat may be violated. The Ben Ish Hai (Rav Yosef Haim of Baghdad, 1833-1909) ruled more stringently, and maintained that in between the third and seventh days after childbirth, Shabbat may be violated only for the sake of needs which the woman specifically requests. However, Hacham Ovadia, following the straightforward implication of the Shulhan Aruch, disagrees, and allows violating Shabbat during this period to care for the woman unless she specifically expresses that she does not require that form of care.
One example would be if the woman needs a nurse to help her use the restroom on Shabbat within a week after childbirth. In such a case, the Poskim allow the woman to press the button – though in an unusual manner – in order to call the nurse so she receives the help she needs.
Summary: During the first 72 hours after childbirth, anything deemed necessary for the woman’s wellbeing may be done, even if this requires desecrating Shabbat, due to the potential risk that exists. After 72 hours, until the end of seven days after childbirth, Shabbat is not violated to care for the woman in a manner which she says is unnecessary, but otherwise, Shabbat may be violated even during this period for the sake of caring for the woman.