The bill, which has been criticised by human rights groups, was signed into law by Poland's President Andrzej Duda.
Poland on Wednesday temporarily suspended the right of migrants arriving in the country via its border with Belarus to apply for asylum.
Prime Minister Donald Tusk declared that the contentious bill would be adopted "without a moment's delay" after it was signed into law by Polish President Andrzej Duda.
“I believe that it is necessary to strengthen the security of our borders and the security of Poles,” Duda announced, despite expressing concerns in the past that the legislation would make it harder for dissidents in Belarus to flee the country's repressive regime.
The new legislation, which will allow Polish authorities to suspend the right to asylum for 60 days at a time, has been roundly criticised by human rights groups.
In February, the United Nations High Commissioner for Refugees (UNHCR) warned Poland that the proposed law would not be compatible with either international or European asylum law.
Human Rights Watch last month said the EU should take legal action against Poland should the bill be implemented, adding that the legislation “flies in the face of Poland’s international and EU obligations" and encouraged the Polish parliament to vote it down.
Tusk has framed the bill as necessary to combat the flow of migrants entering Poland via Belarus, where he and others in his government argue that Moscow and Minsk are deliberately encouraging migrants to try cross in an attempt to destabilise Europe.
The legislation allows Poland to suspend a migrant's right to asylum in such situations, which Tusk has argued amount to a "serious and real threat" to national security.
It allows exemptions for certain categories of people, including minors, pregnant women, individuals with special healthcare needs, people deemed at "real risk of harm" if returned over the border, and citizens of countries such as Belarus that stand accused of using migration as a political weapon.
A last minute amendment to the bill also allows families accompanying minors to claim asylum under the new restrictions.
Despite criticism from NGOs, Tusk has maintained that the legislation is strictly aimed at tackling illegal migration orchestrated by Russia and Belarus and does not infringe on migrants' human rights in general.
Poland's 400-kilometre border with Belarus has long been a scene of crisis, with thousands of people periodically attempting to cross into Poland through thick forests in temperatures that fall below zero in the winter.
Warsaw has spent billions fortifying the location in an effort to combat illegal migration, including erecting a 5.5-metre steel wall topped with barbed wire and a 206-kilometre electronic barrier fitted with motion-sensing cameras.
Rights groups estimate that hundreds have died at the Poland-Belarus border since 2021, with thousands said to have been subject to illegal and violent pushbacks by Polish border guards.