The majority of South Africa is safe for travellers - provided that they take safety precautions as in all major cities. In the big cities and their outskirts like Johannesburg and Cape Town, because of security concerns. However, certain safety rules should be followed:
Do not wander alone either in town or in the townships, especially at night.
Do not show signs of ostentatious wealth (watches, jewellery, cash)
Carry photocopies rather than originals of your ID documents.