That an early pregnancy is protective against breast cancer is something I've known for ten years now. I remember one of my professors, back when I started studying genetics, saying: "Having a baby at 16 may ruin your life but it sure protects you from breast cancer." Today we know a lot more about the cellular and genetic mechanisms that a first pregnancy triggers in the body. And yet how these mechanisms turn out to be protective against breast cancer is still a mystery.
"The ovarian hormones, estrogen and progesterone, play a pivotal role in normal and neoplastic development of the mammary gland. These hormones have a paradoxical role as long duration of estrogen and progesterone are associated with increased breast cancer risk, while short duration of pregnancy level doses are associated with a reduced breast cancer risk ."Pregnancy levels of these two hormones induce permanent changes in gene expression that result in the life-long protective effect against breast cancer. This has been achieved in mouse models, too, by mimicking pregnancy through hormonal administration, followed by carcenogenesis challenges (the poor little mice are exposed to stuff that normally raises breast cancer risk). What I found surprising, and that I didn't know ten years ago, is that there is a slight increase in breast cancer risk after pregnancy, and this risk increases with age, as shown in the graph below (from ):
The graph above, published in , is a qualitative summary from various epidemiological studies. The "base-level" risk for breast cancer is by definition the risk of a nulliparous woman (a woman who's never been pregnant). I originally thought that a full term pregnancy had a protective effect on breast cancer, no matter at what age, and that the protection diminished with age. However, there is a temporary increase in risk following the pregnancy, and this temporary increase grows with age. During pregnancy, both estrogen and progesterone levels rise drastically and temporarily increase the risk of breast cancer. The earlier in life the pregnancy, the lower this increase in risk, and, in the long term, the risk gets reversed drastically. However, for first pregnancies at an older age the temporary increase in risk is much higher and it takes much longer to reverse to the protective effect. As a consequence, having a first child after 35 years of age puts a woman at a higher risk compared to a woman who has never been pregnant. Furthermore, the protective effect is negligible in the presence of the BRCA1 and/or BRCA2 mutations, or with breast cancers that are estrogen/progesterone negative (the cancer cells do not have estrogen/progesterone receptors).
Finding the epidemiological mechanisms that establish the life-long protection inferred by an early pregnancy could pave the way to better prevention and treatments. Meier-Abt and Bentires-Alj's review  is available for free from Cell and I highly recommend it as it has a nice overview of breast cancer risk as well as the current knowledge on the mechanisms that link early pregnancy to protection:
"Most probably, the individual mechanisms are not mutually exclusive and the full protective effect results from a combination of several processes ."Besides estrogen and progesterone, the growth hormone (GH) and prolactin (PRL) also control the development of the mammary gland. And while estrogen and progesterone levels do not change after a woman has had her first child, PRL levels do. Mouse models have found that decreased PRL and GH levels favor cancer regression in animals with mammary tumors, whereas other studies have associated increased levels of PRL and GH with a higher incidence of breast cancer.
Another theory is that mammary cells become less responsive to estrogen and progesterone after pregnancy, and this could be another factor lowering the risk of cancer. It is consistent with the fact that longer exposure to these hormones, on the other hand, increases the risk. In , the authors also list some interesting pathway signaling changes observed after early pregnancy that could be associated with breast cancer protection. One pathway in particular, called wingless related protein (Wnt) signaling, is downregulated after early pregnancy. The pathway is involved in binding ligands from the outside surface of the cell and passing the signal to the inside.
"In women, pregnancy leads to a reduction in the number of hormone-responsive cells and preferential downregulation of protumorigenic genes and pathways in a subset of progenitor cells isolated from normal human breast tissue. The studies point towards the use of Wnt inhibitors to mimic the protective effect against breast cancer of early pregnancy, a finding consistent with the known potent antiproliferation and anticancer activity of Wnt inhibition ."The authors conclude with some outstanding questions that still need to be answered before we can use the information to develop a successful preventive strategy. In particular:
"Does pregnancy at a late age (late pregnancy) fail to induce similar cellular and molecular changes as pregnancy at an early age? And if so, does this explain the absence of parity-induced protection against breast cancer after late pregnancy?"
 Medina D (2005). Mammary developmental fate and breast cancer risk. Endocrine-related cancer, 12 (3), 483-95 PMID: 16172188
 Meier-Abt F, & Bentires-Alj M (2014). How pregnancy at early age protects against breast cancer. Trends in molecular medicine, 20 (3), 143-153 PMID: 24355762