Medicinal plants are inhabited by diverse microbes in every compartment, and which play an essential role in host growth and development, nutrient absorption, synthesis of secondary metabolites, and resistance to biological and abiotic stress. However, the ecological processes that manage microbiota assembly and the phenotypic and metabolic characteristics of the core microbiota of Eucommia ulmoides remain poorly explored. Here, we systematically evaluated the effects of genotypes, compartment niches, and environmental conditions (climate, soil nutrition, and secondary metabolites) on the assembly of rhizosphere soil and bark associated bacterial communities. In addition, phenotypic and metabolic characteristics of E. ulmoides core microbiota, and their relationship with dominant taxa, rare taxa, and pharmacologically active compounds were deciphered. Results suggested that microbiota assembly along the two compartments were predominantly shaped by the environment (especially pH, relative humidity, and geniposide acid) and not by host genotype or compartment niche. There were 690 shared genera in the rhizosphere soil and bark, and the bark microbiota was mainly derived from rhizosphere soil. Core microbiota of E. ulmoides was a highly interactive “hub” microbes connecting dominant and rare taxa, and its phenotypic characteristics had a selective effect on compartment niches. Metabolic functions of the core microbiota included ammonia oxidation, nitrogen fixation, and polyhydroxybutyrate storage, which are closely related to plant growth or metabolism. Moreover, some core taxa were also significantly correlated with three active compounds. These findings provide an important scientific basis for sustainable agricultural management based on the precise regulation of the rhizosphere soil and bark microbiota of E. ulmoides.