Polyhydramnios, too much amniotic fluid, could be caused for a plethora of reasons but <50% are idiopathic. Causes can come from the maternal aspect and others from the fetal aspect. Some maternal causes can be diabetes, RH incompatibility, preeclampsia, etc. Fetal causes can be, multiple gestation, grossly malformed fetus, Circulatory abnormalities, the fetus can't absorb the fluid, and more. This can lead to preterm labor or PROM (premature rupture of membranes)
Oligohydramnios, too little amniotic fluid, is present when there is less than 500ml of fluid seen. Some causes are PROM, IUGR, Structural urinary abnormalities, post maturity/post term pregnancy, fetal demise and more. It can lead to increased risk of infection, fetal demise, and this website mentions other complications like cerebral palsy, preterm birth, and cord compression.
https://www.abclawcenters.com/practice-areas/prenatal-birth-injuries/maternal-medical-conditions/oligohydramnios/
Mechanical obstructions affecting AF levels can be obstruction in the duodenum or esophagus, which isn't allowing the fetus to swallow, thus not ingesting the fluid which can lead to either polyhydramnios or oligohydramnios, it can also be caused from renal issues because not enough fluid will be made. Intrinsic issues have to do with cranial abnormalities that also prohibit the fetus from swallowing.
Measuring amniotic fluid is extremely important, all four quadrants from be measured perpendicular to the lay of the belly, free of cord at the deepest part. Adding up all four should equal to around 8-24 cm. The right amount of fluid provides a window to see the fetus, it would be obvious to the sonographer that theres too little fluid just by that aspect. I saw this today in clinic, 34 weeks with no fluid and it was difficult to get a good window to measure babies head.