Altitude significantly affects vegetation growth and distribution, including the developmental stages of a forest. We used shotgun Illumina sequencing to analyze microbial community composition and functional potential in melojo-oak (Quercus pyrenaica Willd.) rhizospheric soil for three different development stages along an altitudinal gradient: (a) a low altitude, non-optimal site for forest maintenance; (b) an intermediate altitude, optimal site for a forest; and (c) a high altitude, expansion site with isolated trees but without a real forest canopy. We observed that, at each altitude, the same microbial taxa appear both in the taxonomic analysis of the whole metagenome and in the functional analysis of the methane, sulfur and nitrogen metabolisms. Although there were no major differences at the functional level, there were significant differences in the abundance of each taxon at the phylogenetic level between the rhizospheres of the forest (low and intermediate altitudes) and the expansion site. Proteobacteria and Actinobacteria were the most differentially abundant phyla in forest soils compared to the expansion site rhizosphere. Moreover, Verrucomicrobia, Bacteroidetes and Nitrospirae phyla were more highly represented in the non-forest rhizosphere. Our study suggests that rhizospheric microbial communities of the same tree species may be affected by development stage and forest canopy cover via changes in soil pH and the C/N ratio.