Let me thank you for the question.
It is known that children who have not reached the age of puberty are not yet required to fulfill any religious obligations.
It follows that they are not subject to punishment or otherwise since they are not addressed with religious rulings in the first place.
The same applies to fetuses that pass away before they are born, since the person cannot be addressed with anything until he or she comes to this life and meets certain qualifications.
Now, coming to the destiny of the children who are born after the soul has been blown into them and before they have reached the age of puberty, whether they passed away before birth or after birth, Islam assures that the destiny of such children is Paradise.
This destiny is given to them as a way of honoring them and their parents for the patience they show upon losing these little ones. It is also a sign of the magnificent and the all-embracing mercy of Allah that covers everything and everyone.
We are actually told that as soon as they pass away, they are transferred to Paradise and their souls will be enjoying the company of Prophet Abraham (peace be upon him).
One of the Prophet’s Companions, Samurah ibn Jundub once said:
The Prophet used frequently to ask his companions if any of them has seen a dream and he would explain it as much as Allah has enabled him. One day, he said to us, “Last night, two people came to me in a dream and they asked me to go with them and I went with them”, and he mentioned a few things which he has seen in the dream and then said, “until we arrived at a dark small orchard that is full of all spring colors. In that orchard, a tall man whose head I could not see because of his tallness was standing. Around him there was a lot of little children.” Amongst the things which the angels explained to him is that the tall man was Abraham and the children are those who died in a primordial clean nature, that is, before reaching puberty. (Al-Bukhari)
When the day of Resurrection comes and people are brought back to life, such children will come back to life in the same age in which they passed away and they will intercede on behalf of their parents.
Once a Companion narrated that he said to another Companion, Abu Hurairah:
Two of my children have passed away, so can you tell me a hadith that gives me calmness and solace?” Abu Hurairah said: “Yes, the little ones are the birds of Paradise. Each one of them will meet his or her parents, take hold of their clothes, and will not stop until Almighty Allah allows him and his parents into Paradise. (Muslim)
This is generally what happens to the children who die before the age of puberty, whether they pass away before or after birth. The only important thing which we should bear in mind is that parents should be patient to see this great destiny waiting for their children by the grace of Almighty Allah.
As for embryos that die before their souls are blown into them, which according to Islam happens after 120 days of pregnancy, there is nothing clear about their destiny.
In addition, even the rulings relating to wrapping them in burial shrouds and other burial rites are not discussed.
However, one important thing remains that it may be a test from Almighty Allah to test the patience of the parents and surely He will reward them if they receive this calamity with contentment and acceptance.
All of us should be prepared for our destiny and should think about what have we offered for achieving that destiny.
As much as we think about the destiny of these little children and embryos who have not done any single deed or even taken a single breath, we should also think how thankful we are to the blessings of Allah and how patient we are in the tests He gives to us.
We should pray day and night that Allah alleviates the sufferings of those who suffer and increase the rewards of those who show patience in face of tribulations.
If you lose a baby and show patience, you will soon meet your baby in Paradise where you will be joyful with the great reward waiting for you with your little child.
I hope this answers your question. Please keep in touch.
Please continue feeding your curiosity, and find more info in the following links: