The unique ability of the tuberculosis (TB) bacillus, Mycobacterium tuberculosis, to persist for long periods of time in lung hypoxic lesions chiefly contributes to the global burden of latent TB. We and others previously reported that the M. tuberculosis ancestor underwent massive episodes of horizontal gene transfer (HGT), mostly from environmental species. Here, we sought to explore whether such ancient HGT played a part in M. tuberculosis evolution towards pathogenicity. We were interested by a HGT-acquired M. tuberculosis-specific gene set, namely moaA1-D1, which is involved in the biosynthesis of the molybdenum cofactor. Horizontal acquisition of this gene set was striking because homologues of these moa genes are present all across the Mycobacterium genus, including in M. tuberculosis. Here, we discovered that, unlike their paralogues, the moaA1-D1 genes are strongly induced under hypoxia. In vitro, a M. tuberculosis moaA1-D1-null mutant has an impaired ability to respire nitrate, to enter dormancy and to survive in oxygen-limiting conditions. Conversely, heterologous expression of moaA1-D1 in the phylogenetically closest non-TB mycobacterium, Mycobacterium kansasii, which lacks these genes, improves its capacity to respire nitrate and grants it with a marked ability to survive oxygen depletion. In vivo, the M. tuberculosis moaA1-D1-null mutant shows impaired survival in hypoxic granulomas in C3HeB/FeJ mice, but not in normoxic lesions in C57BL/6 animals. Collectively, our results identify a novel pathway required for M. tuberculosis resistance to host-imposed stress, namely hypoxia, and provide evidence that ancient HGT bolstered M. tuberculosis evolution from an environmental species towards a pervasive human-adapted pathogen.