Unfortunately not all pregnancies end happily and approximately 20% of pregnancies will result in a “miscarriage”, where the pregnancy or fetus stops developing early (before 20 weeks gestation).
This often requires treatment to remove the pregnancy material (a curette). The commonest cause is an abnormality of the pregnancy and it is not likely to have bearing on future pregnancies. Under unusual circumstances though, your specialist may advice further investigation.
The grieving process for a lost baby is important, please let your specialist know if you need further help.