Pregnancy brings about profound changes to the mammary gland in preparation for lactation. Changes in immunocyte populations that accompany this rapid remodeling are incompletely understood. We comprehensively analyzed mammary T cells through all parous stages, revealing a marked increase in CD4+ and CD8+ T effector cells in late pregnancy and lactation. T cell expansion was partly dependent on microbial signals and included an increase in TCRαβ+CD8αα+ cells with strong cytotoxic markers, located in the epithelium, that resemble intraepithelial lymphocytes of mucosal tissues. This relationship was substantiated by demonstrating T cell migration from gut to mammary gland in late pregnancy, by TCR clonotypes shared by intestine and mammary tissue in the same mouse, including intriguing gut TCR families. Putative counterparts of CD8αα+ IELs were found in human milk. Mammary T cells are thus poised to manage the transition from a non-mucosal tissue to a mucosal barrier during lactogenesis.