Shares of U.S. defense companies rose in early trading Tuesday, a day after President Donald Trump said the U.S. will stay engaged in the war in Afghanistan.

Northrop Grumman stock rose 1 percent, while Lockheed Martin and Boeing advanced more than 0.7 percent. Boeing and Northrop were also awarded contracts for intercontinental ballistic missile system replacements.

In a primetime address, Trump said that a swift U.S. troops withdrawal from Afghanistan would create a "vacuum" that terrorists would "instantly fill."

"We cannot repeat the mistake in Afghanistan our leaders made in Iraq," Trump added.

Trump had promised to reduce overseas intervention during his campaign, but said in his speech he wanted an outcome to the nearly 16-year-long conflict that was "worthy" of the sacrifices made, "especially the sacrifice of lives."

He also called out Pakistan for being a terrorist hotbed, accusing it of harboring militants. Trump warned Pakistan of the consequences if it didn't crack down on sweeping fundamentalism.

"The U.S. can no longer be silent about Pakistan's safe havens for terrorist organizations, the Taliban and others, that pose a threat to the region and beyond. ... No partnership can survive a country's harboring of militants," Trump said.

Those remarks sent Pakistani stocks plummeting, with the KSE 100 index shedding 2.2 percent on Tuesday.

—CNBC's Jacob Pramuk contributed to this report.