Emergency vehicles rushed to the scene and ambulances took victims to hospital after the blast wrecked the vehicle and left several other soldiers badly injured.
"Today at around 3:15pm, a suicide attacker riding a motorbike detonated himself against a ministry vehicle in the city of Kabul," the ministry of defence said in a statement.
"As a result, two soldiers were killed, and nine others were wounded." The blast came as Afghanistan gears up for the June 14 second-round vote to choose a successor to president Hamid Karzai, and a day after US President Barack Obama made an unannounced visit to American troops in Afghanistan.
"I heard this big bang and when I came out of my house, I saw an army bus full of people covered in blood in front of my house," said local resident Faizullah, 25, who like many Afghans uses only one name.
The bus, which was hit near a cemetery, was badly damaged with its windows blown out.