Embryo implantation is the first step in the establishment of pregnancy in eutherian (Placental) mammals. Although viviparity evolved prior to the common ancestor of marsupials and eutherian mammals (therian ancestor), implantation is unique to eutherians. The ancestral therian pregnancy likely involved a short phase of attachment between the fetal and maternal tissues followed by parturition rather than implantation, similar to the mode of pregnancy found in marsupials such as the opossum. Embryo implantation in eutherian mammals as well as embryo attachment in opossum, induce a homologous inflammatory response in the uterus. Here, we elucidate the evolutionary mechanism by which the ancestral inflammatory fetal-maternal attachment was transformed into the process of implantation. We performed a comparative transcriptomic and immunohistochemical study of the gravid and non-gravid uteri of two eutherian mammals, armadillo (Dasypus novemcinctus) and hyrax (Procavia capensis); a marsupial outgroup, opossum (Monodelphis domestica); and compared it to previously published data on rabbit (Oryctolagus cuniculus). This taxon sampling allows inference of the eutherian ancestral state. Our results show that in the eutherian lineage, the ancestral inflammatory response was domesticated by suppressing a detrimental component viz. signaling by the cytokine IL17A, while retaining components that are beneficial to placentation, viz. angiogenesis, vascular permeability, remodeling of extracellular matrix. IL17A mediates recruitment of neutrophils to inflamed mucosal tissues, which, if unchecked, can damage the uterus as well as the embryo and lead to expulsion of the fetus. We hypothesized that the uterine decidual stromal cells, which evolved coincidentally with embryo implantation, evolved, in part, to prevent IL17A-mediated neutrophil infiltration. We tested a prediction of this hypothesis in vitro, and showed that decidual stromal cells can suppress differentiation of human naive T cells into IL17A-producing Th17 cells. Together, these results provide a mechanistic understanding of early stages of the evolution of the eutherian mode of pregnancy, and also identify a potentially ancestral function of an evolutionary novelty, the decidual stromal cell-type.