Merkel and de Maiziere went to the German forces' headquarters in the northern city of Mazar-i-Sharif, the spokesman said, without giving details of the visit.
It comes six days after the death of a German soldier, part of the NATO-led International Security Assistance Force (ISAF) in Afghanistan.
A German soldier was killed and another wounded in an attack by insurgents in northern Afghanistan on Saturday.
German special forces had been supporting an Afghan operation near the northern city of Baghlan when insurgents opened fire on the Afghan and NATO International Security Assistance Force troops, according to an army statement posted on its Internet site Sunday.
It added that no information was available about losses among the Afghan forces, but said "presumably" several insurgents had been killed.
It was the first German fatality during two years of working within ISAF.
Merkel has condemned it as a "terrorist attack". A total of eight NATO soldiers, including five Americans, were killed in Afghanistan on Saturday -- the bloodiest day this year for international forces.
The militants' annual offensive opened a crucial period for Afghanistan as its security forces take the lead in offensives against insurgents who are fighting to topple the US-backed government.
All NATO combat missions will finish by the end of next year, and the 100,000 foreign troops deployed across Afghanistan have already begun to withdraw from the battlefield.
Germany now has the third-biggest foreign troop deployment in Afghanistan after the United States and Britain, but has drawn down numbers from more than
5,000 to 4,200 now.