For a foreigner who is in South Africa on a valid tourist/visitors visa and has been offered employment by a South African company (i.e. the branch/company is in South Africa), the law does not state that the foreigner would be required to leave the country in order to obtain a work visa.
For many countries (there are exceptions), a change of conditions on a visitors visa is allowed, therefore, a work visa application (appropriate category) can be applied for while the applicant is still in South Africa.