Elgar, who made his one-day debut for South Africa in England in August, will leave for Australia next week. The left-handed batsman and slow left-arm bowler is a similar player to Duminy.
South Africa's convener of selectors, Andrew Hudson, says "we have opted for a like-for-like replacement. Dean can bat anywhere in the top order and he also gives us a backup spin bowling option."
Duminy ruptured his left Achilles tendon in a freak warm-down incident following the opening day's play in the ongoing first test in Brisbane on Friday. He had an operation to reattach the tendon on Saturday.