The reason that reptiles, birds, and even mammals are able to live terrestrial lives is due to the fact that they are all amniotes, that is, they all produce an amniotic egg. Fish and amphibians are not able to be born on land because they require lots of moisture, which they get directly from the water that surrounds them. Amniotes have overcome this limitation with the amniotic egg.
Amniotes are all tetrapods that exhibit an amniotic egg. The amniotic egg is named for the amnion, which is a fluid filled sac that completely surrounds the developing embryo. It protects the embryo, and allows it to be supplied with the moisture it needs without being in direct contact with water. This major development has allowed organisms to become completely terrestrial.
Other structures in the amniotic egg, called the extraembryonic membranes, include the yolk sac, the chorion, the allantois, and of course, the amnion. The yolk sac is the source of nutrients in the amniotic egg, supplying them to the embryo through blood vessels. The chorion is a membrane that allows gases to be exchanged. It retains moisture, while allowing oxygen and carbon dioxide to cross it. The allantois is the embryo’s waste storage system. It stores metabolic wastes, while also exchanging gasses with the chorion.
At first glance, mammals do not seem to be amniotes, because they do not lay eggs, with the exception of the monotremes (platypuses and echidnas). However, mammals are indeed amniotes, because the amniotic egg which they produce remains inside of the body. All mammalian embryos have an amnion and a chorion, while the allantois is incorporated into the umbilical cord; and the yolk sac cells develop into the embryo’s blood cells, and then migrate into the embryo. Most reptile and bird eggs develop a shell, which seals in moisture and protects the egg while allowing gas exchange; and an albumen, which stores additional nutrients. Most mammals (again except the monotremes) lack a shell and an albumen.
The amniotic egg has allowed animals to colonize land, and even become completely terrestrial, as is usually the case. It may seem like mammals are not amniotes, but they share all the important characteristics that define them as such.