I'm so sorry for your loss. Do not blame yourself, it is not anyone's fault. Unfortunately and inexplicably, many people do horrible toxic drugs and are able to carry through a pregnancy (not fair, I know). Each individual has a different combination of health issues that are going to add up to what makes a healthy pregnancy. Yours might be more tenuous for some reason.
I was told the same thing when I had a miscarriage. My opinion is that my OB/gyn didn't recognize that I had a progesterone issue. AFter doing some research, I saw that my ovulation is late in my cycle (like a day or two before I got a period), and that was often a sign of a progesterone deficiency in the second half of a cycle. Lunar phase I think it's called. Anyway my early ultrasound on that miscarriage (8 weeks) showed a 2 week later conception date than they'd assumed. 2 weeks later I miscarried. OB said she thought it just wasn't developing at the proper rate. Next pregnancy, early ultrasound showed the same, conception 2 weeks later than they expected. But I decided to try progesterone cream to support the pregnancy, for the first 16 weeks. The pregnancy was healthy and I have a wonderful baby girl.
Though I still mourn my miscarriage, and it was devastating to go through, I eventually was able to look to the future. I now knew that a healthy pregnancy meant more to me than almost anything else. More than my diet, personal products, cleaning products, and not exercising. I just did an overhaul on my lifestyle, took out anything potentially toxic or endocrine disrupting (including cleaning products, personal products, and many essential oils and herbs), got a book called Fertility Wisdom, got a good fix up with a TCM herbalist and acupuncturist, and used the progesterone cream.
Best wishes for a happy healthy pregnancy ahead of you. Some women find it very healing to go through a ritual to mourn the miscarriage.