Elgar made 83 as South Africa reached 214 for five before bad light ended play. (Agencies)
It has been a time of contrasts for the left-handed Elgar, who heard that he would be playing in Port Elizabeth on the same day that he was told his central contract with Cricket South Africa was not being renewed.
"It was disappointing news before a big Test," said Elgar, "but it probably served as added motivation."
In all likelihood Elgar would have batted at number six or seven but he was told on the morning of the match that he would be in his preferred position as opening batsman because Alviro Petersen was ill.
It was the first time in eight Test matches that he had opened but most of his first-class career has been at the top of the order. "I'm more at home opening the batting," he said.
Elgar showed admirable patience during a 192-ball innings but it was a lack of that quality that cost him his wicket and opened the door for Australia, who won the first Test in Centurion by 281 runs.
He had earlier hit off-spinner Nathan Lyon for two sixes but an attempt to hit a third went horribly wrong, with the ball slicing high off the outside half of his bat to cover.
New cap Quinton de Kock also went softly, lofting part-time leg-spinner Steve Smith to mid-off.
On a slow pitch which negated the menace of Mitchell Johnson and his fellow fast bowlers, Lyon was the best of the Australian bowlers, taking two for 47 in 23 overs.
"We thought it was a pretty good day," said Lyon. "We knew it was a slow pitch and we had to work hard. We'll hopefully take the new ball tomorrow, take five quick wickets and get batting."
South Africa lost captain Graeme Smith and Hashim Amla inside the first six overs. But Elgar and Faf du Plessis (55) put on 112 for the third wicket - only the second century stand against Australia since the start of their 5-0 Ashes sweep against England earlier in the summer.
Elgar saw Smith and Amla depart before he opened his score off the 20th ball he faced.
But he never lost his composure and handled the pace of first-Test destroyer Johnson with courage and skill, albeit in conditions more batsman-friendly than in the first Test at Centurion.
With seven overs remaining in the day, Australian captain Michael Clarke appeared to want to take the second new ball only to be told by the umpires that the light was not suitable for batsmen to face fast bowling.
AB de Villiers and JP Duminy, South Africa's last two specialist batsmen, will resume on Friday and are likely to have to combat the second new ball.
De Villiers took some time to adjust to the pace of the pitch but finished the day unbeaten on 51.
It was the twelfth consecutive Test in which he had made a half-century or better - a new Test record.
Ryan Harris made the first breakthrough when Smith played across the line and was leg before wicket for nine.
Johnson followed up with his 50th Test wicket in seven matches since the start of the Ashes series against England when Amla was beaten for pace and trapped leg before with a full-pitched delivery.
Elgar and Du Plessis steadied the innings before Du Plessis was out off the first ball of the afternoon drinks break, turning a ball from Lyon into the hands of Steve Smith at short leg.
Elgar was one of three changes to the South African team.
In a surprise move, De Kock, another left-hander, who was not part of the original squad, was flown in and batted at number six, with the selectors opting for a specialist batsman in place of injured all-rounder Ryan McLaren.
Left-arm fast-medium bowler Wayne Parnell replaced left-arm spinner Robin Peterson.
Elgar made 83 as South Africa reached 214 for five before bad light ended play.