The amnion is a thin sac which forms around a developing fetus. Birds, mammals, and reptiles all produce amnions in their fetal development. The amnion is designed to protect the fetus as it grows, to reduce the risk of injuries which could interfere with fetal development or lead to fetal death. The size of the amnion varies during the course of development as a consequence of the fact that the amount of room needed by the fetus changes as it gets larger.
In the very early stages of development, the sac is in physical contact with the fetus. As the fetus starts to grow, the sac fills with fluid. The fluid pushes the sides of the amnion away from the fetus and keeps the fetus in a state of suspension. The sac itself is surrounded with a tough other sac known as the chorion which provides additional protection and plays a role in placental circulation in mammals.
By keeping the fetus suspended in fluid, the amnion helps to insulate the fetus from shock. Without the shock absorption provided by the fluid, the fetus could experience problems during development. This makes the sac an artificial version of the aquatic environment in which many organisms develop; since it seems likely that life originated in water, it makes sense that such environments are highly suited to fetal development.
In mammals, when it is time for the fetus to be delivered, the membranes which surround it rupture, causing a release of amniotic fluid. Once the amnion is ruptured, the clock starts ticking on delivery, and the mother can be at risk of infection. It is also possible for amniotic fluid leaks to develop during pregnancy, in which case it can indicate that the mother is experiencing a premature rupturing of membranes (PROM).
In most cases, this structure does a very good job of protecting the developing embryo from shock, infections, and toxins. However, it is possible for the fetus to be exposed to dangerous through the placenta in the case of placental mammals. This is why gestating mammals need to be careful about the environments they frequent and the foods they eat, to reduce the risk of transmitting something harmful through the placenta. In insects and birds, weakening in the walls of the egg can also contribute to problems with fetal development. Likewise, the developing fetus can absorb toxins which may have been stored along with the nutrients intended to sustain it.