How scientists see lactation happening is a good story.
The little pre-mammals were no match for the bigger reptiles and amphibians so those terrified little animals probably sought shelter. They still laid eggs, eggs that did not have hard shells like chicken eggs but were rather a thin parchment. A problem with such thin parchment is drying out. Marsupials solve this with a pouch; the pouch may have been an intermediate step for mammals. The lactation secretion probably came from former hair glands on the female chest.
The secretion was not exactly like mother’s milk of today but did contain chemical precursors of lactose. In a Darwinian interpretation, then, the pre-mammals that provided the moisture and warmth and, eventually, the chemicals most useful in fighting disease were the ones who produced the most successful offspring. Those offspring produced offspring who would behave similarly. Eventually, warmth and moisture providers become dominant. So while those little pre-mammals snuck around for food (and avoid being food for bigger animals), they tried to keep their eggs warm, then moist, then healthy. And the fluid the fluid used to keep the eggs healthy would eventually become mothers’ milk. And, lactation and all, these little pre-mammals lived through the Great Dying.
Picture mammal; what do you see? Probably dogs, cats, humans or maybe elephants or tigers. Those first pre-mammals did not look like any of those; they were sort of an insignificant little blurb in the animal world. Our little ancestors played the role of a reptile’s snack.
So, on the journey from pre-mammal to mammal, lactation is already in place even though using it with a newborn will not happen for a while. Another major change in this transition: warm-blooded from cold-blooded. These first pre-mammals were, like reptiles, cold-blooded.
Cold-blooded animals generally spend a lot of time basking in the sun, not to get a tan but to warm the body. Hunting for food followed warming the body. So what are those little burrowing pre-mammals to do? During the day, they would be a likely target for dinner by the bigger reptiles. No time for a suntan.
That scary existence connects to the transition from cold to warm-blooded. Since showing up in daylight was suicidal, slowly but surely, generation after generation, their bodies invested energy into maintaining a constant temperature. Slowly their bodies developed more thermal insulation and a mechanism for temperature control. Both of these required a larger brain.
The environment of that time was not particularly helpful. Around 210 million years ago, that big Pangaea supercontinent begins to split. Changes were happening, not all for the good. Carbon dioxide levels were rising, much higher than they are now. The forests near the equator spread well northward, almost to the two poles. The oceans were becoming very warm.
Around 200 million years ago, an extinction raised havoc. The earth got too warm – much as it is doing today. Recent research indicates as much as 12,000 gigatons (a gigaton is one billion tons; each ton is 2000 pounds) of methane drifted up from the sea floor to the atmosphere. Too much heat did cause the extinction – and that is what is happening right now.
But the march from pre-mammal to mammal marched on to one final, giant transition step: live birth.
For animals still laying eggs, the very last layer surrounding the baby developing in the egg is a soft bag which will eventually become a shell. Remember, the eggs are getting smaller. For those eggs, that “sort of bag” allows for gas exchange to and from the egg, which is how the secretions got there.
The live birth step began with that special amniote egg that allowed the transition from amphibian to reptile. In the egg, the embryo lived in life-maintaining fluids surrounded by a tough tissue. Around that was more fluid and then the egg shell. That tough tissue transitioned into a unique organ, a different sort of a bag. The bag was called the placenta, and communication between the mother’s body and that bag was by way of the umbilical cord. This placenta belongs to the baby not the mother.
Some pretty careful studies have shown that the process which led to the internal placenta drew upon some ancient genes—changes, remember, are always based on something that happened in the evolutionary line earlier. The reptiles had provided that tough tissue surrounding the fertilized egg. With those ancient genes, particularly genes involving growth and metabolism as a starting place, a pathway into the membrane developed. The pathway allowed for the nutrients formerly provided inside the egg to be provided instead inside the mother, via an umbilical cord. By a combination of copying and merging those ancient genes in different manners, the transition was made. The placenta for all species is not the same, although they all seem to start under the control of the same gene structure.