The Saudi government has warned that illegal foreign workers risk being slapped with prison sentences and fines after a three-month grace period runs out on July 3.
Employers or those who shelter illegal workers will also be liable to up to two years in prison, the interior and labour ministries said in a joint statement on Friday.
It urged those whose work and residency permits have expired to take advantage of the amnesty without penalty, including "special measures" that would allow a change of employer under certain conditions.
The amnesty does not cover those who entered the oil-rich Gulf state illegally.
Saudi Arabia hosts eight million foreign workers, mostly in very low-paid jobs, according to official figures, but economists say there are another two million unregistered non-Saudi workers in the kingdom.
New regulations introduced by the labour ministry aim to reduce the number of foreign workers to create jobs for millions of unemployed Saudis.
Yemenis and South Asians - Indians, Pakistanis and Bangladeshis - who work in low-paid jobs across the kingdom will be worst affected.
About 200,000 people were expelled from the kingdom in the first three months of the year, according to the immigration service.