Most people use the private sector here, so the standard process would be to see a GP and get a prescription. Some drugs may be harder to get a prescription for than others, so it's always a good idea to take a note or prescription from a doctor back home so the SA doctor can see you have a history with the medication. Six-month repeat scripts are common, meaning you'd just have to go to the doctor once and then can pick up your refill at the pharmacy each month. A GP visit will cost from around 300 to 400 ZAR. Prices for medication vary widely, but some generics are well-priced.
Hope that helps!
Do you have your visas sorted already or are you still going through the process of applying?
There's also some useful info here: http://www.vfsglobal.com/dha/southafrica/visitor-visa-section-2.html