Medical journals refer to them as spontaneous abortions when they occur within the first 20 weeks. That doesn't mean accident. When the body doesn't want to continue continue a pregnancy, it is terminated on purpose, often due to chromosomal abnormalities in the fertilized egg or because the implantation of the egg in the uterus is flawed or the embryo has structural defects. Often in the case of chromosomal abnormalities, the egg doesn't even develop at all or only for a short time, but the placenta and gestational sac do, and because they secrete hormones they produce a positive pregnancy test and early pregnancy symptoms.
However, it can also be rejected because the body determines that it has a resource issue and prioritizes the mother or because the mother has abnormalities in the uterus, or there is something affecting her hormones, which could be anything from chronic disease to environmental factors. It is estimated that at least 20% of all pregnancies fail within the first trimester, generally before 12 weeks. It is suspected that the number is likely much higher as many are lost before the mother even suspects that she is pregnant.
It sure doesn't mean on purpose.