The feat was achieved on Day 3 of the Test, on a day in which Quinton De Kock slammed a brilliant 129 that helped South Africa set a formidable target of 381.
Set to make a daunting 381 to win, Pakistan were 153 for three at the close, needing another 228 runs.
After a decent opening stand of 67 runs, Imam was sent back to the hut by a Steyn delivery that moved away from the left-hander from around the wicket - after scoring 35 runs.
Opening batsmen Imamul Haq and Shan Masood both started confidently as they scored freely against Dale Steyn and Vernon Philander, neither of whom was able to find the swing or seam movement that they generated in the first innings. Duanne Olivier gave visitors the third blow as he dismissed Azhar Ali when he was on 15.
Amla has also had a good outing with more than 100 runs in the match and, if one looks beyond the immediate outcome of the Test series, it is good news for South Africa's World Cup prospects as, barring the unexpected, Amla and De Kock will lead off the Proteas batting line-up as they attempt to bring home the 50 overs premier trophy.
Oliver opened the door in the third over of the day when he had the risky Babar Azam (21) hopping with the vicious bouncer that the dynamic stroke-maker could only fend behind to Quinton de Kock.
Pakistan captain Sarfaraz Ahmed features again in our Play of the Day, but this time it's his work with the gloves that has him smashing wicketkeeping records in the Test series against South Africa, writes ANITHA MADIKIZELA.
In an innings studded with flowing strokes, De Kock reached his fifty off 49 balls and his century off 121 deliveries.
BOWLING: Mohammad Amir 20-2-56-2; Mohammad Abbas 18-3-73-1 (1w); Hasan Ali 17-1-83-1; Faheem Ashraf 14-3-42-3 (2nb); Shadab Khan 11.3-0-41-3.