"I can't say now ... let's get out without using our heads. Getting out now would mean women going back into the cellar, girls no longer going to school, farmers growing drugs again and plenty more."
The debate ahead of the September 27 election is believed to have been watched by an audience of 20 million people.
Merkel agreed that pressure needed to be exerted on Kabul to ensure progress but would not be engaged on a specific withdrawal plan.
Last week, she joined French and British leaders in calling for a new international conference on Afghanistan to be held this year, aimed at accelerating the training of local forces as well as laying out a timetable in which Afghans can take full control of security.
On Sunday, the Der Spiegel newspaper reported that a document written for Steinmeier said the conference should "not satisfy itself with vague targets" and that foundations for a withdrawal should be laid in Germany's next four-year parliamentary term.
According to opinion polls Merkel's Christian Democratic Union party is 12 points ahead of the Social Democrats, who are her current coalition partner.
Aside from the brief discussion on foreign policy, the 90-minute debate on Sunday focused mainly on the economy
Germany recently emerged from its deepest recession since World War II and both parties want to convince voters they are best placed to protect jobs and getting the economy on the right track.
Merkel said she would stimulate growth by "lowering certain taxes to motivate workers" and warned that with SPD solutions Germany would "stay at economic rock bottom" for years.
Steinmeier said Merkel's pledge of tax cuts at a time of surging deficits lacked credibility.
He also attacked her on her vow to extend the life of some nuclear energy plants - a politically divisive issue in Germany.
Two weeks of campaigning remain.