The present study aimed to evaluate the influence of environmental factors on essential oils (EOs) composition of Origanum compactum populations sampled all over the distribution area of the species in Morocco, and to determine the extent of the chemical profiles throughout the geographical distribution of the species. The chemical compositions were submitted to canonical correlation analysis and canonical discriminant analysis that indicated a significant relationship between oil components and some environmental factors. According to their chemical composition and edapho-climatic characteristics, two major groups of populations were differentiated. The first group was composed of samples growing in regions with humid climate, clayey, sandy, and alkaline soils. These samples showed high thymol, α-terpineol, linalool, and carvacryl methyl oxide content. The second group consisted of plants belonging to semi-arid climate, and growing at high altitudes and silty soils. These samples were characterized by high carvacrol, α-thujene, α-terpinene, and myrcene content. However, populations exposed to sub-humid climate, appeared less homogeneous and belong mainly either to the first or second group. A significant correlation between some edaphic factors (pH, K O content, soil texture) and the EOs yield of O. compactum plants was evidenced. In spite of the correlation obtained for the oil composition with edapho-climatic factors and the variance explained by the environmental data set, the observed EO diversity might be also genetically determined.