Elgar, 27, hit nine fours and a six in his 91-ball knock after new Test skipper Hashim Amla chose to bat on a placid track at the Galle International Stadium. (Agencies)
The left-handed Elgar and his partner Alviro Petersen (34) gave the visitors a steady start, putting on 70 for the opening wicket off 101 balls.
Petersen was particularly severe on left-arm spinner Rangana Herath, welcoming him with four boundaries in his first over of the day.
Elgar picked fast bowler Shaminda Eranga for special treatment, hitting him for three fours in the same over, including one that crashed away through the point boundary.
The opener, playing in his 10th Test, reached his second half-century in style, smashing off-spinner Dilruwan Perera through midwicket for an elegant boundary.
He also lofted Perera over the long-on boundary fence for the only six of the session.
Desperate for a breakthrough, Sri Lankan skipper Angelo Mathews made frequent bowling changes but failed to find success until the 17th over, when Perera (1-31) had Petersen trapped leg before wicket.
Petersen was unhappy with the decision of on-field umpire Richard Kettleborough and asked for a review.
The decision was upheld when replays showed the ball would have clipped leg-stump.
Petersen made 34 off 46 balls with the help of four boundaries.
Faf du Plessis, batting at number three for the first time, was unbeaten on 14 at the break.
Earlier, South Africa picked a lone specialist spinner in Imran Tahir with JP Duminy as a part-time off-spinner.
Sri Lanka chose two slow bowlers in Herath and Perera.
Elgar, 27, hit nine fours and a six in his 91-ball knock after new Test skipper Hashim Amla chose to bat on a placid track at the Galle International Stadium.