"That country, and particularly the Afghanistan-Pakistan border, is ... where the mujahideen defeated the other superpower," he said.
"They now have the opportunity to defeat a second superpower, which more than anything would empower their message and the opportunity to recruit and fund raise and plan operations."
The comments by Gates, a former CIA chief, come as leftists and US foreign-policy critics increasingly call for a US pullout.
Dozens of protesters gathered outside the White House on Monday, and a few were arrested when they chained themselves to the gates.
Seeking to shore up support, Obama has invited senior Democratic and Republican politicians to the White House on Tuesday to discuss the war.
He will meet his national security team to continue the policy review on Wednesday and Friday.
Obama almost doubled the US troop total in Afghanistan to 62,000 to combat the worst violence since US-led forces ousted the Taliban rulers in 2001.
But signing off on the 30,000- to 40,000-troop increase that the top US and Nato commander in Afghanistan, General Stanley McChrystal, is said to have requested would be politically risky for Obama.
Unease within his own Democratic party has been voiced increasingly, as is fatigue among the American public after eight years of war in Afghanistan.
Last week, McChrystal warned that Taliban fighters were gathering strength.
"The situation is serious and I choose that word very, very carefully," he told military and defence experts at the International Institute for Strategic Studies in London on Thursday.
"My best military judgment is that the situation is, in some ways, deteriorating."
He went on to say that unrest across the country was up, and it was up "not only because there are more coalition forces, it is up because the insurgency is growing".
Any plan that falls short of stabilising Afghanistan "is probably a shortsighted strategy", McChrystal said, and he called openly for additional resources.
That prompted retired General James Jones, Obama's national security adviser, to say on Sunday that military advice is best provided "up through the chain of command".