The measure passed both chambers of the Republican-controlled state Legislature on Wednesday and Gov. Tom Wolf, a Democrat, said he will sign it.
As a result, Pennsylvania will join more than 10 states in delaying primaries.
It comes just a few months after Wolf and lawmakers approved legislation giving every voter the ability to mail in a ballot.
Under the bill, Pennsylvania will hold its primary election June 2, instead of April 28, when the state could be in the thick of a surge of COVID-19 cases.
Wolf's administration has steadfastly refused to publicly discuss projections for when it believes the surge of cases will peak, however. But training and recruiting poll workers during that time could prove impossible, lawmakers say.
Senate Majority Leader Jake Corman, R-Centre, said the Wolf administration has given him no sign of whether it believes the surge of coronavirus cases could ease by June 2, enough for people to vote in-person.
“That’s the million-dollar question, or billion or maybe trillion now with the numbers we're talking about in Washington, DC,” Corman told reporters.
The Democratic Party's presidential delegate selection rules prevent primaries later than June 16, putting Pennsylvania up against a deadline.
If it becomes clear that it will be impossible to hold an election on June 2 because of the virus, lawmakers and the governor will look at options when that time comes, Corman said.
Rep. Kevin Boyle, D-Philadelphia, had pushed for the legislation to include money to pay for counties to send mail-in ballot applications to every registered voter, but he said that Republicans blocked it.
“Hopefully we can move to address that in the weeks to come," Boyle said.
In addition to delaying the primary date, the legislation gives county election offices a head start on processing and tabulating mail-in ballots, newly allowed under a five-month-old election law.
Letting election workers start at 7 a.m. on election days, instead of after polls close, is designed to help them avoid a massive backup that county officials have warned could extend vote counting in the presidential race for days afterward.
It also requires that challenges to those ballots be filed by the Friday before election days to lighten the post-election load of processing and counting mail-in and absentee ballots.
Separately, the legislation lets counties consolidate polling places, in part because some are currently located within nursing homes that could be susceptible to outbreaks of the coronavirus. Many poll workers are older people who are particularly at risk, lawmakers say.
Primary voters will pick candidates in contested races for president, Congress and the Legislature.
Follow Marc Levy on Twitter at www.twitter.com/timelywriter
Follow AP coverage of the virus outbreak at https://apnews.com/VirusOutbreak and https://apnews.com/UnderstandingtheOutbreak.