Ferns are the only major lineage of vascular plants that have nutritionally independent sporophyte (diploid) and gametophyte (haploid) life stages. However, the implications of this unique life cycle for fern community ecology have rarely been considered. To compare patterns of community structure between fern sporophytes and gametophytes, we conducted a survey of the ferns of the islands of Moorea and Tahiti (French Polynesia). We first constructed a DNA barcode library (plastid rbcL and trnH‐-psbA) for the two island floras including 145 fern species. We then used these DNA barcodes to identify more than 1300 field‐collected gametophytes from 25 plots spanning an elevational gradient from 200 to 2000 m. We found that species richness of fern sporophytes conforms to the well‐known unimodal (i.e., mid‐elevation peak) pattern, reaching a maximum at ~1000–1200 m. Moreover, we found that fern sporophyte communities become increasingly phylogenetically clustered at high elevations. In contrast, species richness of fern gametophytes was consistent across sites, and gametophytes showed no correlation of phylogenetic community structure with elevation. Turnover of sporophyte and gametophyte communities was closely linked with elevation at shallow phylogenetic levels, but not at deeper nodes in the tree. Finally, we found several species for which gametophytes had broader ranges than sporophytes, including a vittarioid fern with abundant gametophytes but extremely rare sporophytes. Our study highlights the importance of including diverse life history stages in surveys of community structure, and has implications for the possible impacts of climate change on the distribution of fern diversity.