Remember that antibodies are formed in body only when antigens come in direct contact with the system
In case of pregnant lady there is a barrier between the fetus and maternal tissue so their circulation are separate. The fetal blood comes in contact with maternal system during delivery when the placenta is cut.
This disease occurs due Rh incompatibility when mother is Rh- and baby is Rh+
Rh antibody is IgG type and can cross placenta and they act at body temperature.
During first pregnancy there are no antibody in the mother's blood so baby is normal
But during delivery mother is sensitized by Rh+ blood that enters her body and corresponding
antibodies are formed
When this lady becomes pregnant again with Rh+ child these antibodies cross placenta and destroy fetal RBC causing this condition.