1,118. A Baby Who Died Uncircumcised
163:6 If a baby was born at twilight or immediately before, a Torah scholar should be consulted regarding when to have the bris.
163:7 If a baby died before being circumcised, whether it was within the first eight days or after, he is circumcised at the time of burial so that he should not be buried uncircumcised, as this would be considered shameful for him. No bracha is recited over such a circumcision but the baby is given a name as a sign that he should receive mercy from Heaven and be among those resurrected and have the ability to recognize his parents. If they forgot and buried him uncircumcised, if they remembered immediately so that there is no concern that he began to decompose, they need to exhume and circumcise him. If they didn't realize until some days later, they do not do so.