Local media said 83-year-old Rita du Plessis was being treated for a respiratory infection, but ended up in theatre for a procedure to remove excess moisture around her heart.
Her doctor at Mediclinic in the central city of Kimberley had mixed up patients' names in a phone discussion with the surgeon.
"A misunderstanding between two specialists led to the wrong patient being operated on," the hospital said in a statement.
Beeld newspaper reported that the physician realised his mistake when the patient was already in theatre undergoing the surgery.
Also Read
The doctor and the hospital have apologised for the mix-up.
"After being made aware of the incident by the treating doctor, the hospital and doctors engaged in constructive discussions with the patient and her family," hospital spokeswoman Denise Coetzee told AFP.
Mediclinic said Du Plessis had "handled the operation well" and will not be asked to pay for the procedure.