Cause and effect. Freedom of choice.
I don't think my miscarriages were anything to do with Deity, karma, sinfulness etc. I think that they were purely biology.
Mine came after two pregnancies and births, so my perspective was coloured by positive experiences. Probably I would have felt different - worse! - had I not already managed to carry a child. But miscarriage did not affect my belief in the existence of Deity. That actually came through pregnancy. The act of growing new life drew me closer to the feeling that there is more to us than purely biology.
My grandmother used to say that God does not lay upon us a weight wider than our shoulders. At the time of a trouble, this may not comfort. But, having passed through it and come out the other side, I see that it has become part of who I am, just one of the many influences, and sometimes, with hindsight, I see positive aspects to the negative experience.