Baptize in Case of Miscarriage (pdf print)
Baptizing Miscarried and Stillborn Babies: The Other Unborn
Roman Rite (pdf … below is from the Baptism section)
1964 Roman Rituale Book of blessings and rites (Extraordinary Form) – General Instructions on Baptisms: mentions about conditions for baptism in the womb
20. No child is to be baptized while still enclosed in the mother’s womb, as long as there is a probable hope that it can be properly brought forth and then baptized. If only the head of the child has come forth and there is danger of its dying, it should be baptized on the head; if afterward it is born and lives, baptism may not be repeated conditionally. If another member of the body makes its appearance and there is danger of death, the baptism should be conferred conditionally upon that member; if the child lives after birth it must be rebaptized conditionally. Should a mother die in confinement, the fetus should be extracted by those obliged there to by their profession, and if there is a certainty that it lives, it should be baptized absolutely, otherwise conditionally. A fetus baptized while in the mother’s womb must be rebaptized conditionally after birth.
21. One should see to it that every abortive fetus, no matter of what period, be baptized absolutely if it is certainly alive. If there is doubt about its being alive, it should be baptized conditionally.
Here is a link on what to do regarding what to do regarding baptism and miscarriages.