The attacks in Baluchistan province – home to a low-level insurgency and various militant groups – have raised concerns for the election in the troubled Western ally, where many voters are already disillusioned by political feuding and an economic crisis.
The first blast took place in the office of an independent candidate, Asfandyar Kakar, in the Pishin district of Balochistan on Wednesday afternoon, deputy commissioner Jumma Dad Khan said.
At least 17 people were killed in the explosion, while more than 20 injured were rushed to a nearby hospital, where some were admitted in critical condition.
"The initial probe suggests that it was an IED (improvised explosive device) explosion, and the explosive was placed on a motorcycle," AFP quoted a police officer as saying.
A second blast shortly after killed at least 12 people at a Jamiat Ulema Islam party's office in Qila Saifullah district, with at least another eight wounded.
Mir Zubair Khan Jamali, a caretaker minister of Balochistan province, expressed his condolences and said Pakistan's "enemies were looking to create instability" ahead of the polls.
“The election process will not be affected by such an attack,” he said, according to The Dawn newspaper.
Pakistan is holding elections for a new parliament on Thursday, with at least 44 political parties in the fray for a share of the 266 seats that are up for grabs in the national assembly and an additional 70 seats reserved for women and minorities.
About 128 million Pakistanis are eligible to cast their vote in the general election amid a severe economic crisis and an inflation rate as high as almost 30 per cent. The country has agreed to a recovery path set out by the International Monetary Fund as part of a $3bn bailout deal.
The bombing took place despite a massive police deployment of tens of thousands of police and paramilitary forces across the country to ensure a peaceful election.
The Balochistan province at the border of Afghanistan and Iran has been the scene of the insurgency by Baluch nationalists for more than two decades.
Earlier this week at least 10 police personnel were killed and six others sustained injuries in a pre-dawn attack by militants in northwest Pakistan.
The Pakistani Taliban also has a strong presence in Baluchistan and have targeted civilians in recent years, though the Pakistani Taliban pledged not to attack election rallies ahead of the vote.
Caretaker Prime Minister Anwaarul-Haq-Kakar denounced the bombings and conveyed his condolences to the families of those who died. He vowed that "every attempt to sabotage the law and order situation will be thwarted" and said the government is committed to holding elections on Thursday in peace.
Mr Achakzai announced a three-day mourning period but emphasised that "the elections will take place”.
The Election Commission of Pakistan in a statement said it had taken notice of the bombing in Pishin and “sought immediate reports from the chief secretary and the Balochistan police chief and directed them to take action against those involved in the incident”.
Balochistan's interim chief minister Ali Mardan Khan Domki said the blast was a "conspiracy to undermine the process of peaceful elections". Despite the ongoing violence, he urged voters to step out to cast their ballots on Thursday.
Pakistan Peoples Party (PPP) chair Bilawal Bhutto-Zardari condemned the "terrorism in Pishin" and the "barbaric act" of targeting innocent people.
"The planners involved in the bomb blast should be brought to justice," he said in a statement.
Jailed former prime minister Imran Khan earlier in the day urged his supporters to wait outside polling booths after casting their votes on Thursday.
“Encourage the maximum number of people to vote, wait at the polling station ... and then stay peacefully outside the returning officer’s office until the final results are announced,” said Mr Khan on his social media handle on X.