All perfect praise be to Allah the Lord of the Worlds. May Allah`s peace and blessings be upon our Prophet Mohammad and upon all his family and companions.
As regards the ruling of Sharia on offering funeral prayer for the miscarried fetus, scholars differentiated between the following situations:
First: If it is six months and more, it takes the same ruling of the dead adult. It is washed, shrouded, and offered funeral prayer.
Second: If it is less than six months, there are two cases:
1- If it shows signs of life, then it takes the same ruling of the dead adult. It is washed, shrouded, and offered funeral prayer. This is based on the general meaning of the narrations indicating that offering funeral prayer for the dead is an obligation.
2- If it doesn`t show signs of life, then it isn`t permissible to offer it funeral prayer. It is considered inanimate, so it isn`t offered funeral prayer since it was narrated from Jabir (May Allah Be Pleased with him) that the Messenger of Allah (Peace be upon him) said: "If the child has cried, the (funeral) prayer should be offered for him (if he dies) and he is an heir." [Related by Ibn Majah].
In addition, if it is four months old, then it should be washed. If not, then it is just buried. And Allah The Almighty Knows Best.