Most amniocentesis procedures happen between 15 and 20 weeks of gestation (during the second trimester of pregnancy). Having an amniocentesis earlier in pregnancy poses more risks, such as miscarriage. In some cases, healthcare providers perform amniocentesis tests later in pregnancy. If your provider recommends this test to check fetal lung development or treat polyhydramnios, it will likely happen during the third trimester.