Note: Updated answer on 11 February 2017 because link in previous answer is now broken.
A South African consulate page in the US has this statement:
Travelers transiting through the following international airports are
exempted from/do not have to be in possession of transit visas, but
will be subjected to biometric capturing directly at the airport:
- OR Tambo International;
- Cape Town International;
- King Shaka; and
- Lanseria (Johannesburg)
Please note that the above-mentioned exemption
does not apply to deportees. Please also note that foreigners who are
utilizing land ports of entry to transit through the Republic of South
Africa and who are subject to South Africa visa control should apply
for and be issued with port of entry visas.
I haven't been able to find anything on the South Africa site, but the South African embassy in Australia has this statement - link now broken:
Transit Visa Requirements
Visa restricted passport holders who want to transit South Africa to
any one of South Africa's neighbouring countries, MUST apply for a
transit visa. The neighbouring countries are Botswana, Lesotho,
Mozambique, Namibia, Swaziland and Zimbabwe.
Passport holders who want to transit a South African port of entry
enroute to any other country, may do so without the need to apply for
a transit visa.
I found the same statement on a South African Airlines website.