Disclaimer: I'm not a historian. Lots of hand-waving happens to make this work. I also believe that xenophobia, racism and bigotry makes countries weaker.
The only way South Africa could have successfully split among racial lines would be if whites could get rid of the need for cheap labor, either through automation, or having more financial resources, or both.
A very large share of South Africa's GDP is from mining, especially gold and diamond mining, but the mines are largely owned by British foreign interests. Another large part is the export of food, especially corn grown in Kwazulu-Natal.
The alternate history
If the British hadn't won the second Anglo-Boer war (which was partially motivated by newly discovered mineral resources in South Africa), it's possible that the two independent states of the Orange Free State and the Transvaal (map) would have merged and kept control of the vast mineral wealth of South Africa. They would need to conquer Natal to gain access to a port. Thus forms the Boer Free Republic (BFR).
Given their long enmity with the British empire, the BFR may have allied with the German colony in German South West Africa during the first world war.
Given the established alliances, and South Africa's strong ties with Japan, and obvious ideological similarities, the BFR may have allied with the Axis powers during the Second World War.
Whether that war was won or lost, if the Boer Free Republic retained it's independence due to successes in that war, many German engineers and scientists may choose to flee to the BFR.
It's at that point where the gradual rebuilding and development of those countries after the war, and the realization that long-term dependence on black labor is untenable, that the search of a technological solution to the labor problem starts.
Utilizing the knowledge of German engineering and the Japanese automation revolution, South Africa largely automates mining, and improves agricultural automation. Through the further careful choice of less labor-intensive crops, they manage to gradually free itself of the need of black labor. They start deporting workers to the Cape.
A real-world aside
Orania had this exact problem, and developed nut-harvesting technology to obviate the need for labor intensive nut-picking. (They built machines that shake the nut trees and catch the nuts. It's pretty nuts.)
In addition, there was talk of automating mining after the recent mining strikes for higher wages. Apparently the technology to automate mining has existed for a while, but has not been the most economical option.