A "rainbow baby" is a baby that is born following a loss of a baby.
In the real world, a beautiful and bright rainbow follows a storm and gives hope of things getting better. The rainbow is more appreciated having just experienced the storm in comparison.
The storm (pregnancy loss) has already happened and nothing can change that experience. Storm-clouds might still be overhead as the family continue to cope with the loss, but something colourful and bright has emerged from the darkness and misery.