Kenya's Interior Ministry ordered the suspension on Wednesday of a visa-free transit agreement with Pakistan.
The move was prompted after social media sites showed videos with crowds of Pakistani nationals crowding residential areas across the capital, Nairobi.
According to the authorities there has been an influx of Asian foreigners who at first were thought to be Afghan refugees.
Interior Principal Secretary Karanja Kibicho ordered the police to work closely with the immigration services to crack down on illegal foreigners.
In a statement, Kibicho said "the majority of these travellers have originated from Pakistan and have valid transit visas to Saudi Arabia that are issued on arrival. Going forward, the government will restrict the number of foreigners transiting through the country to levels that do not pose a risk to Kenya's national interest".
Kenya’s Citizen Digital reported that in a letter to the High Commission of Pakistan, Kenya’s Foreign Affairs Ministry said: “the Government of Kenya regrets that some of these passengers are taking advantage of Kenya’s status with these countries with regard to the COVID-19 quarantine regulations. This threatens to undermine Kenya’s agreements with these countries which are put in place to ensure continuation of business and travel operations between our countries”.