Amniocentesis is a medical procedure used to diagnose genetic and chromosomal conditions in a fetus. It involves extracting a small amount of amniotic fluid from the amniotic sac surrounding a developing fetus. This fluid contains fetal cells and various chemicals that can be tested to assess the health and development of the fetus.