Hey, Grace. Your question is similar to the question about all untimely deaths in the world. Newborn babies die. Children die. Teenagers. Young adults. Anything that's below old age is horrible and tragic. Why? There're many theories - God saves the person's soul by not letting them commit a horrible crime or something; the person's soul has already done its job on earth; or, in the worst case, Satan kills the person (the person chooses Satan and this choice leads to their untimely death). I think none of us will have the exact answer while we're here. I know how you feel, though, as I also lost my first baby in my third month, its heart just stopped beating. It was one of the most horrible moments in my life. The guilt you feel. The feeling that you're an incubator of death, instead of life. The worry about the feature - will I ever be able to carry a baby? And so on...
Trust God. ❤️