Raffinose family oligosaccharides (RFOs) are implicated in plant regulatory mechanisms of abiotic stresses tolerance and, despite their antinutritional proprieties in grain legumes, little information is available about the enzymes involved in RFO metabolism in Fabaceae species. In the present study, the systematic survey of legume proteins belonging to five key enzymes involved in the metabolism of RFOs (galactinol synthase, raffinose synthase, stachyose synthase, alpha-galactosidase, and beta-fructofuranosidase) identified 28 coding-genes in Arachis duranensis and 31 in A. ipaënsis. Their phylogenetic relationships, gene structures, protein domains, and chromosome distribution patterns were also determined. Based on the expression profiling of these genes under water deficit treatments, a galactinol synthase candidate gene (AdGolS3) was identified in A. duranensis. Transgenic Arabidopsis plants overexpressing AdGolS3 exhibited increased levels of raffinose and reduced stress symptoms under drought, osmotic, and salt stresses. Metabolite and expression profiling suggested that AdGolS3 overexpression was associated with fewer metabolic perturbations under drought stress, together with better protection against oxidative damage. Overall, this study enabled the identification of a promising GolS candidate gene for metabolic engineering of sugars to improve abiotic stress tolerance in crops, whilst also contributing to the understanding of RFO metabolism in legume species.