The government of Khyber-Pakhtunkhwa ordered the provincial Home Department to seal the Pakistan-Afghanistan border at Torkham to "avert the entry of unwanted persons for maintenance of peace" during the elections, officials said.
Authorities also instructed the Additional Chief Secretary of the restive tribal areas to restrict Afghan refugees to their camps from May 10 to 12 for security reasons.
Officials were ordered to initiate legal proceedings under the Foreigners Act against illegal Afghan aliens found in the provincial capital of Peshawar during May 10 to 12.
The general election will mark the first democratic transition of power in the country's 66-year history.
However, campaigning for the polls in the country's northwest has been hit by attacks by the Taliban, who have been targeting workers and leaders of liberal parties like the Pakistan People's Party and Awami National Party.