The aim of this study was to investigate the major compounds of wild and cultivated Origanum compactum essential oils and to study their antibacterial activity. The wild O. compactum was harvested at the flowering stage from northern Morocco, and then, two modes of culture were realized: seed germination and cuttings. Essential oils were isolated using steam distillation and the chemical composition was determined by GC‐MS. The antibacterial activity was tested against four bacterial strains (Escherichia coli, Bacillus subtilis, Staphylococcus aureus and Listeria innocua) using the well diffusion assay; then, the minimum inhibitory concentration (MIC) and the minimum bactericidal concentration (MBC) were determined by the microdilution method. The results showed that carvacrol (11.05%‐63.65%), thymol (0.16%‐30.72%), p‐cymene (6.69%‐36.79%), γ‐terpinene (0.86%‐22.37%) and trans‐caryophyllene (0.15%‐5.76%) were the major compounds. The rate of these compounds varied importantly between wild and cultivated O. compactum. The antibacterial assays revealed that all oils tested from wild and cultivated studied O. compactum showed strong activities. The diameter of inhibitory zones varied from 10.33 to 49.00 mm, and the MIC and MBC values ranged from 0.06% to 0.5% (v/v) and from 0.12% to 0.5% (v/v), respectively, with significant differences between wild and cultivated plants. From these results, it was concluded that the domestication of O. compactum using seed germination and cutting significantly affects the amount of the major compounds and consequently its antimicrobial properties.