"America's enemies must never know our plans, or believe they can wait us out. I will not say when we are going to attack, but attack we will," said Trump, before a crowd of US troops.
While he admitted he previously favored withdrawal, Trump said doing so would dishonor the US troops who died in Afghanistan and could create a vacuum that would allow terrorist networks to expand.
In setting out what he described as a new approach to the 16-year campaign, Trump had harsh words for US ally Pakistan, saying Washington could "no longer be silent about Pakistan's safe havens for terrorist organizations."
"We have been paying Pakistan billions and billions of dollars, at the same time, they are housing the very terrorists we are fighting ... that must change immediately," Trump added.
He also called on Pakistan's regional rival India, to "help us more with Afghanistan, especially in the area of economic assistant and development."
"We appreciate India's important contributions to stability in Afghanistan but India makes billions of dollars in trade from the United States and we want them to help us more with Afghanistan, especially in the area of economic assistance and development."
In response to Trump's pledge, the Taliban issued a defiant statement, saying the US should have thought about withdrawing its troops from Afghanistan instead of prolonging the war.
"It looks like the US still doesn't want to put an end to its longest war. Instead of understanding the facts and realities, (Trump) still shows pride for his power and military forces," the statement said, vowing Taliban forces would keep fighting to free Afghanistan of "American invaders."
Afghan President Ashraf Ghani welcomed Trump's statement and his "affirmation of support for our efforts to achieve self-reliance and for our joint struggle to rid the region from the threat of terrorism."
"The US-Afghan partnership is stronger than ever in overcoming the threat of terrorism that threatens us all," Ghani said in a statement Tuesday, adding the "objective of peace is paramount."
Washington has long accused Islamabad of not doing enough in efforts to stabilize Afghanistan.
US officials believe that much of the Haqqani leadership is based in Pakistan and some analysts believe eliminating their safe havens is critical to stabilizing Afghanistan.
Trump seemed to reference this in his speech Monday, saying that "Pakistan has much to gain from partnering with our effort in Afghanistan (and) much to lose from harboring criminals and terrorists."
"Pakistan has ironclad immutable strategic interests which dictate maintaining ties to groups like the Taliban," said Michael Kugelman, deputy director and senior associate for South Asia with the Asia Program at the Woodrow Wilson Center.
"It sees them as useful tools to keep Pakistan's enemy, India, at bay in Afghanistan."
Taking a tough line on Pakistan "is not a new idea" said Lahore-based defense analyst Hasan Askari Rizvi, "(Trump) just appears to be more categorical and clearer than previous administrations."
"The future of Afghanistan is inextricably linked to the future of its neighbor, Pakistan," Obama said, calling on Islamabad to "demonstrate its commitment to rooting out al Qaeda and the violent extremists within its borders."
Trump repeatedly mentioned the 9/11 attack as the reason for US action in Afghanistan during his speech.
However, what the President will do to ensure Pakistan does change its behavior is unclear, said Kugelman. Tactics could include cutting aid and curtailing military assistance to Islamabad, he added.
Concerns in Islamabad will be heightened not only by Trump's criticism of Pakistan, but also his reaching out to India.
But Trump seemed to indicate that friendship would not be without conditions Monday. "India makes billions of dollars in trade from the United States, and we want them to help us more with Afghanistan," he said.
Trump had similar expectations for other powers. "We will ask our NATO allies and global partners to support our new strategy with additional troop and funding increases in line with our own," he said.
"Since taking office, I have made clear that our allies and partners must contribute much more money to our collective defense, and they have done so."
In a statement Tuesday, India's Ministry of External Affairs said New Delhi welcomed Trump's "determination to enhance efforts to overcome the challenges facing Afghanistan and confronting issues of safe havens and other forms of cross-border support enjoyed by terrorists."
"We are committed to supporting the government and the people of Afghanistan in their efforts to bring peace, security, stability and prosperity in their country," the statement said. "We have been steadfast in extending reconstruction and development assistance to Afghanistan in keeping with our traditional friendship with its people."
However, Rizvi in Lahore warned giving India a bigger role in Afghanistan could backfire on Washington by reducing Islamabad's willingness to contain terror groups based in Pakistan.
"Under the present circumstances, tensions between India and Pakistan will increase," he said.
Greater Indian involvement in Afghanistan doesn't only put it in competition with Pakistan, but also China, which has been investing heavily in both countries as part of its "One Belt, One Road" economic program.
Trump did not mention China once during his speech Monday.
Trump has previously expressed reservations about the seemingly endless US military commitment in Afghanistan and questioned the objectives of staying there.
The President reached a decision on the future of the US strategy in Afghanistan on Friday after months of deliberation.
Trump's decision comes as Taliban militants have been resurgent in recent months, posting a series of recent gains against Afghan government forces, which are backed by a US-led coalition of NATO allies.
The United States first invaded Afghanistan on October 7, 2001, as part of Operation Enduring Freedom.
The Bush administration accused the country's then Taliban government of sheltering al Qaeda leader Osama Bin Laden, who had masterminded the previous month's September 11 terrorist attacks.
The Taliban offered to hand over Bin Laden for trial, but only to a third country, rather than directly to the United States. Washington refused the offer and launched air and ground attacks, joined shortly thereafter by US allies.
CNN's Steve George, Sophia Saifi, Ben Westcott and Jeremy Diamond contributed to this report.
More:
Trump calls out Pakistan, India as he pledges to 'fight to win' in Afghanistan - CNN