Cape Town - Bafana Bafana have been drawn in Group D in the African Cup of Nations (AFCON) tournament hosted in Egypt in June later this year.
Stuart Baxter's charges were drawn on Friday alongside Namibia, Ivory Coast and Morocco.
Defending champions Cameron will face Ghana, Benin and Guinea-Bissau in Group F.
Bafana Bafana clinched qualification to the 24-team tournament after a 2-1 away win over Libya in Tunisia last month.
South Africa have tasted AFCON success after clinching the title in 1996 after beating Tunisia 2-0.
This will be the first 24-team Cup of Nations - up from 16 - and will be hosted from June 21 to July 19.
The six group winners and six runners-up automatically qualify for the knockout second round and will be joined by the four best third-placed teams.
After the eight second-round fixtures, there will be the quarter-finals, semi-finals, a third-place play-off and the final.
Group A: Egypt (hosts), Zimbabwe, Uganda, Democratic Republic of Congo
Group B: Burundi, Madagascar, Guinea, Nigeria
Group C: Tanzania, Kenya, Algeria, Senegal
Group D: Namibia, South Africa, Ivory Coast, Morocco
Group E: Angola, Mauritania, Mali, Tunisia
Group F: Guinea-Bissau, Benin, Ghana, Cameroon (holders)