England won the second Test by 189 runs but Anderson, who previously battled a calf injury, bowled only two overs after lunch on the final day.
He had removed nightwatchman Keshav Maharaj right at the start of the day but didn’t bowl in the second session. The 37-year-old returned to bowl a two-over spell after tea but was taken out of the attack due to discomfort.
The Lancashire quick will undergo scans on his injury which will decide his participation for the Port Elizabeth Test starting January 16.
"We'll assess him in the morning and take it from there," England head coach Chris Silverwood told BBC Sport. "We've got to make sure he's all right now.
"When somebody of Jimmy's quality is potentially going to be missing, it is always going to be a concern for the coach - and concern for the team - because we want him in there. He showed in the first innings that he is a great bowler."
England have plenty of options in the sidelines in case Anderson doesn’t recover in time. Jofra Archer and Mark Wood will be available for selections after recovering from injuries while Craig Overton and Chris Woakes are also in the pipeline.
Anderson could only bowl four overs in the entire Ashes with a calf problem which also kept him out for the New Zealand Test series. He then utilized the services of football club Manchester City, training under the best possible medical staff.
In a bid to prepare for South Africa series, he had arrived early in the country as a part of ECB camp in Potchefstroom.