When you arrive you will have to go through customs and immigration in Johannesburg, because this will be your first port of entry into the country, same as anywhere. 2 hours is "tight" 3 hours is usually recommended.