The men were arrested on Thursday, along with three Afghan nationals.
It was not clear if the attackers were attempting to free the prisoners, or even if they knew that the two men were in the convoy.
"I wouldn't rule out that they were targeted or killed on purpose," Major-General Athar Abbas, a military spokesman, said.
"They were killed as a result of an IED [improvised explosive device] exploding on the side of the road ... There are a number of daily, IED incidents in this area," he said.
Rasul Bahksh Rais, a political scientist at Lahore University, said that the killings may have been deliberate to prevent Alam and Izzat from giving away information to military intelligence officials.
"I think it was a targeted killing by the militants because they could identify the whereabouts of some of the militant [leaders]," he told the Express 24/7 television network.
"They were high-value targets."
Sufi Muhammad had brokered a deal that allowed the Taliban to enforce its interpretation of sharia, or Islamic law, in Malakand district, in return for its fighters laying down their arms, but the deal fell apart in April, soon after it was instated.
The convoy attack comes just one day after a suicide bombing at a mosque in Upper Dir, which borders Swat, killed at least 30 people.
A man wearing an explosives vest entered the mosque and blew himself up, Atlass Khan, an Upper Dir police official, said.
"People tried to intercept him because he looked like an outsider, someone who does not belong to this area,'' Khan said.
No one has yet claimed responsibility for the bombing, but it is the latest in a surge of violent episodes thought to be in response to the military's campaign against the Taliban in Swat.
Al Jazeera's Imran Khan, reporting from Islamabad, said that the recent incidents suggested Taliban fighters were returning to a tactic of small-scale, disruptive attacks.
"What we're hearing is this is a renewal of an old tactic. What the Taliban are doing is using hit-and-run raids, rather than house-to-house or street-to-street fighting.
"We'll likely see many more of these types of attacks ... which will be devastating for the army as they'll have to deal with them on a daily basis."
Since late April, the military has focused a concerted air and ground assault against Taliban fighters in Swat.
General Ashfaq Kayani, the Pakistan army chief, said in a statement that the military had succeeded in clearing much of the area.
"The tide in Swat has decisively turned. Major population centres and roads leading to the valley have been largely cleared of organised resistance by the terrorists," he said.
But his words come against a backdrop of attacks on civilian targets in retaliation for the military offensive.
Pakistan has been rocked by more than a dozen bomb blasts that have killed over 100 people since the end of April, with Peshawar, the main city in the northwest, and the cultural capital, Lahore, both hit.
The United States has strongly backed the Pakistani military operation.
Richard Holbrooke, the US special envoy to Afghanistan and Pakistan, was in Islamabad on Friday to consult the country's leaders on what needs to be done after confronting the Taliban in the Swat valley.
He also warned that US plans to increase troop levels in Afghansitan, where it has been fighting since it toppled the Taliban in an invasion in 2001, could prompt an influx of Taliban fighters into Pakistan in response.
"I don't want to be alarmist here, but I'm predicting some massive influx," he said.
Islamabad voiced its concern to Washington in April that the deployment of US reinforcements in the south of Afghanistan could push fighters over the frontier.