Ivory Coast and Guinea are despatching specially chartered aircraft to Tunisia to bring hundreds of their citizens back home.
Officials in both Conakry and Yamoussoukro expressed alarm at inflammatory comments made last week by the Tunisian President, Kais Saied.
Mr Saied said that illegal migration was causing “demographic” changes in the country, saying those who were there illegally would not be allowed to stay.
He accused them of being behind rising crime in Tunisia.
He also instructed Tunisian security forces to take urgent measures against undocumented migrants from sub-Saharan Africa.
Dozens of Guineans and Ivorians have sought refuge in their countries’ embassies. Some have reported being physically assaulted.