These procedures are not associated with pregnancy loss during the second trimester but they are associated with miscarriages and birth defects in the first trimester. Miscarriage caused by invasive prenatal diagnosis (chorionic villus sampling (CVS) and amniocentesis) is rare (about 1%). Surgery
The effects of surgery on pregnancy are not well-known including the effects of bariatric surgery. Abdominal and pelvic surgery are not risk factors for miscarriage. Ovarian tumours and cysts that are removed have not been found to increase the risk of miscarriage. The exception to this is the removal of the corpus luteum from the ovary. This can cause fluctuations in the hormones necessary to maintain the pregnancy. Medications
There is no significant association between antidepressant medication exposure and spontaneous abortion. The risk of miscarriage is not likely decreased by discontinuing SSRIs prior to pregnancy. Some available data suggest that there is a small increased risk of miscarriage for women taking any antidepressant, though this risk becomes less statistically significant when excluding studies of poor quality.Medicines that increase the risk of miscarriage include:

retinoids
nonsteroidal anti-inflammatory drugs (NSAIDs), such as ibuprofen
misoprostol
methotrexate
statins

Immunizations
Immunizations have not been found to cause miscarriage. Live vaccinations, like the MMR vaccine, can theoretically cause damage to the fetus as the live virus can cross the placenta and potentially increase the risk for miscarriage. Therefore, the Center for Disease Control (CDC) recommends against pregnant women receiving live vaccinations.
U.S. National Library of Medicine.