Desecrating Shabbos on behalf of a Yoledes: 
Like a dangerously ill person: A Yoledes [see exact Halachic definition in Halacha 3] is [considered] like a dangerously ill person and one [thus] is to desecrate Shabbos on her behalf for all of her needs. [See Halacha 2 for a list of her needs]
The requirement to use an irregularity upon desecration: Nevertheless [despite the fact that she is considered like a dangerously ill patient], since the pain of a Yoledes is natural and not [even] 1 of 1000 die from childbirth, therefore the Sages were stringent to require one to change [from his way of normally doing the action needed of desecrating Shabbos] in whatever he is able to change in it.
For example: If one needs to bring the woman a vessel through a public area then her assistant should bring it through tying it to her hair which is carrying in an irregular way and does not contain a Biblical prohibition. The same applies for all cases of the like.
If she [the Yoledes] needs oil then her friend should not smear oil on her hair and then come to her [the Yoledes] and squeeze the oil out, rather she should bring it in a vessel which is hanging on her hair, as it is better to carry [the oil] with a vessel in an irregular way, without any other prohibition, then to add in doing the squeezing prohibition, even though that squeezing hair is only Rabbinically forbidden as was explained in chapter 326 [Halacha 5].
A woman which has reached a state in labor in which she is defined as a Yoledes [see Halacha 3] may have Shabbos desecrated on her behalf for of all her needs. However whenever a desecration is done it is to be done in an irregular manner, in whatever way one is able to change from the normal method that the act is done during the week.
May one desecrate Shabbos on behalf of treating or preventing a miscarriage?
Yes. This applies even if she is less than 40 days pregnant and even if there is no danger to her but there is possibility of saving the pregnancy.