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.
The co-author of this disaster is the Dutch government, which did not find either strength or desire to save the lives of its citizens who were flying on that plane. The Dutch authorities did not demand Ukraine to comply with international aviation regulations