Peternell won his second appeal at CAS, after a previous ruling decided that South Africa should not have selected the lower-ranked Paul Hart.
Despite the first verdict, the South African Sports Confederation and Olympic Committee (SASCOC) simply withdrew Hart but did not enter Peternell for the games.
"It is with regret that one of our loyal countrymen, Paul Hart, has to bear the brunt of this sad situation," SASCOC chief executive Tubby Reddy said in a statement. "It forces upon the South African public an athlete that they do not necessarily recognize and one that they do not necessarily support."
Peternell, who was born in Roodeport and grew up in Johannesburg, said in a statement he was "especially shocked" by Reddy's comments.
CAS said its three-lawyer panel "upheld the request of Peternell and has ordered SASCOC to include him in the team of South Africa."
Reasons for the decision will be published later.
"As we all know, this athlete (Peternell) has been based in the United Kingdom for the last 11 years consecutively," Reddy said in his statement, adding a direct apology to Hart.
"It is our belief that your selection was in fact a fair process. Unfortunately with this ruling of CAS we cannot deviate in any way whatsoever."
Peternell expressed sympathy with Hart and described his selection as "a bittersweet moment."
"I intend to do South Africa proud and represent my country with all the determination that has seen me earn the right to compete in the first place," he said.
The eventing competition, comprising dressage, cross-country and jumping rounds, begins Saturday and ends Tuesday.