The social amoeba Dictyostelium discoideum maintains a microbiome during multicellular development; bacteria are carried in migrating slugs and as endosymbionts within amoebae and spores. Bacterial carriage and endosymbiosis are induced by the secreted lectin discoidin I that binds bacteria, protects them from extracellular killing, and alters their retention within amoebae. This altered handling of bacteria also occurs with bacteria coated by plant lectins and leads to DNA transfer from bacteria to amoebae. Thus, lectins alter the cellular response of D. discoideum to bacteria to establish the amoebae’s microbiome. Mammalian cells can also maintain intracellular bacteria when presented with bacteria coated with lectins, so heterologous lectins may induce endosymbiosis in animals. Our results suggest that endogenous or environmental lectins may influence microbiome homeostasis across eukaryotic phylogeny.