Miscarried because of blood type

Marie 🌺 • Mommy of two 💕
I'm devastated after two years of conceiving I managed to conceive but ended up loosing the baby because of my blood type.. Comes to find out I'm A- and my husband is O+. So I had to take the Rhogam shot. How can I get pregnant without miscarrying at such an early stage. I'm upset because the doctors desire to find this out when I miscarried and not help me when the baby was still fighting to stay alive.. Upset need feed back thank you.