What is the ruling if a child commits suicide before the age of puberty?
Suicide is a major sin. The Prophet (blessings and peace of Allah be upon him) stated that the one who commits suicide will be punished with something like that with which he killed himself.
See the answer to question no. 70363
There are known signs of puberty for both males and females. The male reaches puberty when one of three things happens: emission of maniy (semen), growth of pubic hair or reaching the age of fifteen years according to the Hijri calendar, which is a few months before reaching the age of fifteen according to the Gregorian calendar.
In females, puberty is reached when these three signs occur; in addition to that there is a fourth sign, namely menstruation.
It is not stipulated that all of these signs should appear; rather when one of them appears that is sufficient to rule that the individual has reached puberty.
See also the answer to question no. 70426 and 78591
Accountability is waived for the child who has not yet reached puberty, until he reaches that stage, because of the report narrated by Abu Dawood (4403) and at-Tirmidhi (1423) from ‘Ali (may Allah be pleased with him), that the Prophet (blessings and peace of Allah be upon him) said: “The Pen has been lifted from three: from the sleeper until he awakens, from the child until he reaches puberty and from the insane person until he comes to his senses.”
Classed as saheeh by al-Albaani in Irwa’ al-Ghaleel, 2/4, no. 297
In al-Mawsoo‘ah al-Fiqhiyyah (8/196) it says:
A person becomes accountable for fulfilling obligatory duties and refraining from haraam actions when he or she reaches puberty; one who has not reached puberty is not accountable … and (one who has not reached puberty) is not subject to qisaas (retaliatory punishments) and hadd punishments, such as those for stealing and slander. However, it is permissible for him to be disciplined. End quote.
See also 14/36
A person from whom the Pen has been lifted because he is insane or is a minor is not subject to qisaas (retaliatory punishment) if he injures or kills someone, whether the minor had reached the age of discernment or not, because the Prophet (blessings and peace of Allah be upon him) said: “The Pen has been lifted from three: from the child until he reaches puberty, from the insane person until he comes to his senses and from the sleeper until he awakens.”
End quote from al-Haawi al-Kabeer, 12/181
Ibn Qudaamah (may Allah have mercy on him) said: A minor is not to be executed (in the case of apostasy), regardless of whether we say that his apostasy is valid or not, because the child is not subject to punishment, on the basis that the rulings on adultery and theft and other crimes that are subject to hadd punishments are not applicable to him to him and he cannot be executed in a retaliatory punishment (qisaas).
End quote from al-Mughni, 10/62
Based on that, there is no punishment in the Hereafter for a child if he does something before the age of puberty, which is attained when one of the signs mentioned above appears.
For more information please see the answer to question no. 3277.