South Africa's federation says Madagascar pulled out of Saturday's game amid xenophobic violence in Johannesburg.
The 2012 champions fell to a 1-0 loss away from home and will miss next year's tournament.
A goalless draw away from home was enough to see Recreativo Libolo of Angola secure the last spot in the African Confederation Cup quarter-finals.
Spain rallied with two late goals to salvage a 2-2 draw with England in a friendly at Wembley on Tuesday.
Senegal and Egypt qualified for the African Nations Cup thanks to wins against Burnundi and Tanzania.
Aston Villa striker Jordan Ayew failed to convert a close-range opportunity for Avram Grant's group leaders.
Ghana defeated Mozambique 3-1 in Accra in a 2017 African Nations Cup qualifier on Thursday.
Islam Slimani netted twice in the second half to save a 2-2 draw for Algeria away at Tanzania.
DR Congo and Guinea earned crucial away wins in the second round of African qualifying for the 2018 World Cup.
Ghana eased to victory over Mauritius in their opening 2017 African Nations Cup qualifier, while Cameroon left it late to beat Mauritania.