This has to be one of the most painful hardships any parent has to bear, especially the mother. However, as a parent you want to make sure your baby has the correct funeral rites and burial whether the baby died because of a miscarriage or still birth.
If a baby is born alive and lives for a few minutes, hours or days, then all 5 rites have to be performed. The naming, the washing, shrouding, you will pray the funeral prayer on them and then bury them.
If the baby is born stillbirth, you will only perform 3 out of the 5 funeral rites. You name the baby, you wash the baby and you bury the baby. You do not need a proper shroud for the baby or pray the funeral prayer on the baby. You will also do this for the miscarriages of babies where the limbs are formed.
If the woman suffers a miscarriage and the limbs are not formed, an early term miscarriage then there is no naming, no washing, no shrouding and no prayer. You just need to wrap the embryo in a cloth and bury it.
May Allah protect all pregnant women and bless them with healthy babies. May Allah bring comfort and ease to all of those who have lost babies and let these babies be a door to their Jannah. Ameen.