- Don't have ESPN? Get instant access
Egypt and Senegal, who are still competing at the Cup of Nations in Cameroon, were two of the five countries that represented the continent at the last finals in Russia.
Elsewhere, Morocco were drawn against Democratic Republic of Congo, who did not qualify for the Nations Cup in Cameroon.
Mali have a chance to qualify for the first time after being paired with Tunisia, but face staging their home game on neutral territory; they did not have any fit stadia in the previous qualifying round and played home games in Morocco.
The 10 countries in Saturday's draw were all winners of their groups in the second round of African World Cup qualifiers played between September and November.
They now meet over two legs in March to determine which five teams will reach the finals. The exact dates of the matches will be announced in the next days, said the Confederation of African Football.
Full draw: Egypt vs. Senegal, Cameroon vs. Algeria, Ghana vs. Nigeria, DR Congo vs. Morocco, Mali vs. Tunisia