Elgar will leave for Australia later this week once his visa formalities have been completed, CSA said.
"We have opted for a like-for-like replacement," CSA selection convener Andrew Hudson said in a statement.
"Dean can bat anywhere in the top order and he also gives us a back-up spin bowling option.
"He is currently in good form and made 76 with a strike rate of 107 in the Chevrolet Knights' only 50 overs' game to date.
"He had a good debut for the Proteas in their recent ODI series in England and he fully deserves his call-up to our Test squad as well."
Duminy was ruled out for the rest of the three-Test series with Australia after he ruptured his Achilles tendon while warming down kicking a rugby ball after the end of play at the Gabba on Friday.
Dean Elgar to replace injured JP Duminy in Australia
Advertisement