Sulfoquinovosyltransferase 2 (SQD2) catalyses the final step in the sulfoquinovosyldiacylglycerol (SQDG) biosynthetic pathway. It is involved in the phosphate starvation response. Here, we show that rice SQD2.1 has dual activities catalysing SQDG synthesis and flavonoid glycosylation. SQD2.1 null mutants (sqd2.1) in rice had decreased levels of glycosidic flavonoids, particularly apigenin 7-O-glucoside (A7G), whereas these metabolites were increased in rice plants overexpressing SQD2.1. The sqd2.1 mutants and SQD2.1 overexpressing lines showed reduced and enhanced, respectively, tolerance to salinity and drought. Treating the sqd2.1 mutants with A7G decreased oxidative damage and restored stress tolerance to the wild-type levels. These findings demonstrate that SQD2.1 has a novel function in the glycosylation of flavonoids that is required for osmotic stress tolerance in rice. The novel activity of SQD2.1 in the production of glycosidic flavonoids improves scavenging of reactive oxygen species and protects against excessive oxidation.