Merkel arrived in Mazar-e-Sharif early Monday. She originally planned also to visit Kunduz, another northern area where German troops are based, but bad weather meant it wasn't possible to fly there.
The chancellor's previously planned but unannounced visit came a day after at least one American soldier shot to death 16 civilians in southern Afghanistan and burned their bodies.
Merkel spoke with Karzai by phone from Mazar-e-Sharif and offered her "personal condolences" following "the terrible actions of a U.S. soldier," a German government spokesman said.
She also assured him that the NATO-led security force in Afghanistan will do everything to clear up what happened, the spokesman said on condition of anonymity in line with department rules.
Germany has some 4,800 troops in the NATO-led force in northern Afghanistan.
By the end of January 2013, the government aims to get troop numbers down to 4,400. That's part of plans by the U.S. and other allies to withdraw combat troops and hand over responsibility for security to Afghan authorities by the end of 2014.