if Jews are not supposed to hurt themselves, why can a child be pierced for earrings?
Although self-infury is prohibited, where the purpose is constructive, such as for earrings, it is permitted.
In addition, it is possible that a simple piercing, for the above purpose, is not considered an injury at all, so that even those authorities who prohibit cosmetic surgery (most permit — see below) will permit the piercing.
The wearing of earrings has been prevalent from biblical times till today, and there is no question that it is fine.
The ruling of Rambam concerning causing oneself (or someone else) bodily harm indicates that the prohibition does not apply to every form of injury. To quote: “It is forbidden for a person to injure both himself or others, and one who does so … in a destructive manner. transgresses a Negative Commandment.”
The wording of Rambam implies that only those injuries that are destructive—meaning violent or harmful—are prohibited. Injuries that are constructive and purposeful would, therefore, not be prohibited.
Tosafos (Bava Kama 91b), however, appear to disagree with this ruling, stating, “a person may not cause himself injury even for a purpose.” Rashba concurs with the ruling of Tosafos, stating that a person may not cause himself bodily harm under any circumstances—even when the injury would bring him emotional relief. According to these Rishonim, it emerges that even “constructive injury,” which Rambam permits, falls under the prohibition of self‐injury.
However, it would appear that for earrings, the creating of the hole is not considered an “injury” at all, for purposes of the prohibition, so that all authorities will agree that it is permitted.
For more details on the issue (a discussion of cosmetic surgery), please see here.