Cotton is an important natural fiber crop. The RF2 gene family is a member of the bZIP transcription factor superfamily, which plays an important role in plant resistance to environmental stresses. In this paper, the RF2 gene family of four cotton species was analyzed genome-wide, and the key gene RF2-32 was cloned for functional verification. A total of 113 RF2 genes were identified in the four cotton species, and the RF2 family was relatively conserved during the evolution of cotton. Chromosome mapping and collinear analysis indicated that fragment replication was the main expansion mode of RF2 gene family during evolution. Cis-element analysis showed that there were many elements related to light response, hormone response and abiotic stress response in the promoters of RF2 genes. The transcriptome and qRT-PCR analysis of RF2 family genes in upland cotton showed that RF2 family genes responded to salt stress and drought stress. GhRF2-32 protein was localized in the cell nucleus. Silencing the GhRF2-32 gene showed less leaf wilting and increased total antioxidant capacity under drought and salt stress, decreased malondialdehyde content and increased drought and salt tolerance. This study revealed the evolutionary and functional diversity of the RF2 gene family, which laid a foundation for the further study of stress-resistant genes in cotton.