That is a really bad comparison. I suspect that you misused the word Apartheid because of its emotional connetation (which circumvents any rational reasoning that a non-emotional argument might entail).
Apartheid was concerned with the area people lived in the same country (in this area it might be seen as unjust - since people had citizenship to the country. Then again, SA is a country that should not have existed in the first place - the only ties that bind South Africans together is that they were all subject to British colonialism and their mutual dislike for each other).
In any case, the Apartheid regime tried (very successfully) to prevent illegal immigration from neigbouring countries (since for some strange reason South Africa was the only industrialized country). This was done with fairly great success. The motivation for this was twofold: to prevent insurgents from infiltrating the country and protect the jobs of black people (the white minority government was fearful of black unemployment - for this reason unemployment of black people were far less than 10% then and regularly 30-50% after '94).
Typing on i phone, continued below.