The attack occurred about 35 kilometers (20 miles) south of the northern city of Kunduz. The assailant was believed to have been riding a motorcycle, the headquarters said in a statement.
The injured troops were taken by helicopter for treatment at Camp Marmal in Mazar-i-Sharif.
The German military has about 3,500 troops stationed in northern Afghanistan with the NATO-led International Security Assistance Force. Violence has climbed steadily in the war-ravaged nation despite a growth in the number of international soldiers in the country.
The German Foreign Ministry announced earlier on Wednesday that a German citizen missing since late July in Afghanistan is presumed to be the victim of a criminal kidnapping.
The ministry was informed the man was missing on July 29, one day after the return of German Foreign Minister Frank-Walter Steinmeier from Afghanistan, spokesman Jens Plötner said. Plötner called the case a "criminal kidnapping" and said a German emergency task force is working on the case with the Afghan authorities.
The man, a dual citizen of Germany and Afghanistan believed to have been living and working in Kabul, has been missing since July 25. He is 33 years old and grew up in Hamburg, according to the website of German news magazine Der Spiegel.
German news agency DPA quoted unnamed sources in the security community in Kabul as saying the missing man had returned to Afghanistan about six months ago for business and disappeared in Kabul in the evening after work. Officials do not believe the kidnapping is linked to politics or to Germany, according to DPA.
The news agency quoted an unnamed source as saying the case was "typical of the local kidnapping industry."
Spiegel reported that while the man's family at first believed they could resolve his case by paying a small ransom, his kidnappers broke off contact several days ago.
German authorities have been seeking another missing German citizen, cabinetmaker Harald Kleber, 42, in Afghanistan since late last year. Kleber had lived in Afghanistan since 2003 and married an Afghan woman. Kleber is believed to be dead.