May, who is conducting the first working visit by a British leader to South Africa since 2011, joined in with the students, moving from side to side and bobbing up and down.
In the later part of her visit to the I.D. Mkize Senior Secondary School, she joined in with a second group of students who were dancing.
“Can I thank all those young people who were involved in the performance outside who welcomed me,” May told the crowded school.
The British leader has previously said Abba gets her “up and going,” but her dance moves in South Africa drew plenty of reaction on Twitter.