However, he also cautioned that people should expect more violence and more setbacks.
Obama has pledged to deal with the situation in the two countries with a joint strategy that deploys about 20,000 more troops to Afghanistan to combat the rising threat from Taliban and al-Qaeda fighters and hand billions of dollars in aid to Pakistan.
Al Jazeera's James Bays, reporting from Washington DC, said the talks, which will continue in the coming days, would have left Obama in no doubt as to how bad things have got in the region.
In addition, while officials on both sides acknowledge they have common problems, they believe there is a limit to the US idea of treating them together in a joint strategy, as both nations have their own issues and have concerns over their sovereignty, he said.
In advance of their meeting with Obama, Karzai and Zardari held talks with Hillary Clinton, the US secretary of state, against a backdrop of fears over the deteriorating security situation in both nations.
Pro-Taliban fighters have taken control of territory in large parts of Afghanistan and Pakistan, where they have pushed to within 100km of Pakistan's capital, Islamabad.
"We know that each of your countries is struggling with the extremists who would destabilise and undermine democracy," Clinton said.
Zardari promised to aid the US and Afghanistan in the battle against al-Qaeda and Taliban fighters.
"We stand with our brother Karzai and the people of Afghanistan against this common threat, this menace, which I have called a cancer," Zardari said.
Karzai, describing Pakistan and Afghanistan as "conjoined twins", said: "Our suffering is shared."
Anthony Cordesman, a former senior intelligence analyst at the US defence department, told Al Jazeera that the stakes were high for the US, and for Obama, in securing stability in the region.
"If you lose Afghanistan, it essentially becomes a sanctuary for [Osama] bin Laden, for extremist movements, a training ground [and] a centre of terrorism"
former US defence department analyst
"If you lose Afghanistan, it essentially becomes a sanctuary for [Osama] bin Laden, for extremist movements, a training ground [and] a centre of terrorism in the region basically throughout the world," he said.
"As far as Pakistan goes, the situation is even worse. It's a nuclear power, you have no idea where the weapons may end up.
"You see it potentially being used as a lever, a centre of power to put pressure on countries throughout the Islamic world and again as a centre of terrorism."
The meeting in Washington comes amid anger in Afghanistan over the reported deaths of more than 100 civilians in an alleged US raid in the western province of Farah this week, an Afghan official said.
Obama pledged on Wednesday to make "every effort" to avoid civilian casualties in Afghanistan.
Earlier Clinton said she deeply regretted the deaths in Farah, but neither she or Obama accepted blame for the deaths.
During the talks, Pakistan and Afghanistan also signed an agreement to begin talks on establishing a trade route which will allow Indian goods to reach Kabul.