Obama has chided Karzai for not doing more to build confidence in his government, whose grip remains weak after the ouster of the Taliban in 2001.
U.S. Embassy spokesman Mark Stroh said Obama and the senators discussed issues including the painstaking rebuilding of the country's government and economy, the security situation and corruption with Karzai.
The Afghan presidency said Obama's message was positive. "Sen. Obama conveyed ... that he is committed to supporting Afghanistan and to continue the war against terrorism with vigor," said Humayun Hamidzada, Karzai's spokesman.
Both Democrats and Republicans "are friends of Afghanistan and no matter who wins the U.S. elections, Afghanistan will have a very strong partner in the United States," Hamidzada said.
Obama has made Afghanistan a centerpiece of his proposed strategy for dealing with terrorism threats. The Illinois senator has said the war in Afghanistan, where Taliban and al-Qaida-linked militants are resurgent, deserves more troops and more attention as opposed to the conflict in Iraq. Both Obama and his Republican rival for the presidency, Sen. John McCain, advocated sending more forces to the country.
In an interview broadcast Sunday in the United States, Obama described the situation in Afghanistan as "precarious" and "urgent," and said the U.S. should not wait to begin the planning that would be needed to send in more troops.
As he has before, Obama said "one of the biggest mistakes we made strategically after 9/11 was to fail to finish the job here. We got distracted by Iraq."
But as troops sent to Iraq as part of the buildup of forces there begin to leave, Obama says one to two brigades should be sent to Afghanistan to bolster efforts here.
"The situation is precarious and urgent here in Afghanistan and I believe this has to be our central focus, the central front in our battle against terrorists," Obama told CBS News.
"Now, we have a chance, I think, to correct some of those errors," he said. "If we wait until the next administration it could be a year before we get those troops on the ground."
While officially part of a congressional delegation on a fact-finding tour also expected to take him to Iraq, Obama traveled in Afghanistan amid the security accorded a likely Democratic nominee for president rather than a senator from Illinois.
Media access to Obama was limited, and his itinerary in the war zones was closely guarded. Traveling with him were Sens. Chuck Hagel, a Nebraska Republican, and Jack Reed, a Democrat from Rhode Island.
Obama made no public comment after the meeting with Karzai, which included a traditional lunch of mutton, chicken and rice washed down with a yogurt drink.
Earlier in the day, he praised U.S. troops during breakfast with soldiers at Camp Eggers, a heavily fortified military base in the city.
"To see young people like this who are doing such excellent work, with so much dedication ... it makes you feel good about the country," Obama said.
"I want to make sure that everybody back home understands how much pride people take in their work here and how much sacrifice people are making. It is outstanding," he said in footage filmed by the military and obtained by The Associated Press.
On Saturday, the delegation received briefings from U.S. commanders and a former Afghan warlord who is now the governor of Nangarhar, a province in eastern Afghanistan where militant attacks are spiraling.
Obama's first overseas tour since securing the Democratic nomination -- he is scheduled to visit Europe through next week -- could be key to honing his foreign policy strategy less than four months before the Nov. 4 election. McCain has criticized Obama for not spending more time in the region.
Obama advocates ending the U.S. combat role in Iraq by withdrawing troops at the rate of one to two brigades a month while increasing the military commitment to Afghanistan. Obama has proposed sending two more combat brigades -- about 7,000 troops -- to Afghanistan. McCain also is advocating sending more forces to the war-battered country.
U.S. military officials say the number of attacks in eastern Afghanistan, where most of the U.S. forces in the country operate, has increased by 40 percent so far this year compared to the same period last year.
Gen. David Petraeus, the top U.S. commander in Iraq, told The Associated Press on Saturday that after intense U.S. assaults there, al-Qaida may be considering shifting focus to its original home base in Afghanistan, where American casualties are recently running higher than in Iraq.
Obama also has expressed weariness with efforts by Afghanistan's neighbor, Pakistan, to go after militants in its territory. That frustration may strike a chord with Karzai, who has accused Pakistan's intelligence service of supporting the Taliban insurgency -- a claim that Pakistan denies.
But Obama also has chided Karzai and his government, saying it had "not gotten out of the bunker" and helped to organize the country or its political and security institutions.