The majority of miscarriages do take place in the first twelve weeks of pregnancy. The medical term is “early miscarriage,” and the cause is usually chromosomal abnormalities in the fetus. It's far less likely — but still possible — for a pregnancy to fail after those first three months. A miscarriage between weeks twelve and twenty is less likely due to genetic problems with the baby and more likely the result of something amiss in the mother’s body, such as a structural problem with the uterus or an incompetent cervix. (All not your fault!) Luckily, these problems are rare.
Regardless of your stage of pregnancy, try your hardest not to worry. There will always be things you can't control, both in pregnancy and parenthood, so focus on what you can can — eating right, exercising moderately and getting lots of rest.