A judge ordered the foster mom to give up custody days before the baby died while under the care of his biological parents.