The Saudi government warned on Friday that illegal foreign workers risk being slapped with prison sentences and fines after a three-month grace period runs out on July 3.
Additionally, employers or those who shelter illegal workers will be liable to up to two years in prison, the interior and labour ministries said in a joint statement.
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.
Signup to our newsletter and follow us on Facebook and Twitter!
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.
Some 200,000 people were expelled from the kingdom in the first three months of the year, according to the immigration service.