The soldiers were part of a Danish reconnaissance unit that came under fire in Gereshk Valley in Helmand Province, the Army Operational Command said.
The two were evacuated by helicopter to a Danish camp where they were pronounced dead.
"It is with great regret that I have received the news that two Danish soldiers from the reconnaissance unit in the Danish battalion in southern Afghanistan fell in a battle with the Taliban," Maj. Gen. Poul Kiaerskou, head of the Army Operational Command, said in a statement.
The military did not release any other details about the shooting.
Denmark has some 600 troops in Helmand province that are part of NATO's 40,000-member force in Afghanistan.
A total of nine Danish troops have now been killed in Afghanistan.
Austria does not intend to expel Russian diplomats because of the spy scandal