Obligate endosymbiosis, in which distantly related species integrate to form a single replicating individual, represents a major evolutionary transition in individuality(1-3). Although such transitions are thought to increase biological complexity(1,2,4-6), the evolutionary and developmental steps that lead to integration remain poorly understood. Here we show that obligate endosymbiosis between the bacteriaBlochmanniaand the hyperdiverse ant tribe Camponotini(7-11)originated and also elaborated through radical alterations in embryonic development, as compared to other insects. The Hox genesAbdominal A(abdA) andUltrabithorax(Ubx)-which, in arthropods, normally function to differentiate abdominal and thoracic segments after they form-were rewired to also regulate germline genes early in development. Consequently, the mRNAs and proteins of these Hox genes are expressed maternally and colocalize at a subcellular level with those of germline genes in the germplasm and three novel locations in the freshly laid egg.Blochmanniabacteria then selectively regulate these mRNAs and proteins to make each of these four locations functionally distinct, creating a system of coordinates in the embryo in which each location performs a different function to integrateBlochmanniainto the Camponotini. Finally, we show that the capacity to localize mRNAs and proteins to new locations in the embryo evolved before obligate endosymbiosis and was subsequently co-opted byBlochmanniaand Camponotini. This pre-existing molecular capacity converged with a pre-existing ecological mutualism(12,13)to facilitate both the horizontal transfer(10)and developmental integration ofBlochmanniainto Camponotini. Therefore, the convergence of pre-existing molecular capacities and ecological interactions-as well as the rewiring of highly conserved gene networks-may be a general feature that facilitates the origin and elaboration of major transitions in individuality.