Legumes, unlike other plants, have the ability to establish symbiosis with nitrogen-fixing rhizobia. It has been theorized that a unique property of legume root cortical cells enabled the initial establishment of rhizobial symbiosis1-3. Here we show that a SHORTROOT-SCARECROW (SHR-SCR) stem cell program in cortical cells of the legume Medicago truncatula specifies their distinct fate. Regulatory elements drive the cortical expression of SCR, and stele-expressed SHR protein accumulates in cortical cells of M. truncatula but not Arabidopsis thaliana. The cortical SHR-SCR network is conserved across legume species, responds to rhizobial signals, and initiates legume-specific cortical cell division for de novo nodule organogenesis and accommodation of rhizobia. Ectopic activation of SHR and SCR in legumes is sufficient to induce root cortical cell division. Our work suggests that acquisition of the cortical SHR-SCR module enabled cell division coupled to rhizobial infection in legumes. We propose that this event was central to the evolution of rhizobial endosymbiosis.