His remarks were in contrast to the US President's stance, who had earlier made clear his desire to bring an end to the 17-year Afghan conflict and withdraw the vast bulk of American forces.
"Afghans must control their own future and be involved in ongoing peace discussions and there are no orders to reduce US troop levels in Afghanistan," Shanahan said, according to Colonel Dave Butler, a spokesman for Resolute Support, the NATO training mission in Afghanistan.
Butler said Shanahan would meet with both the government and Resolute Support leadership and the talks would focus on national security concerns related to Afghanistan.
Shanahan was scheduled to meet Afghan officials, including President Ashraf Ghani and coalition military commanders amid growing momentum in peace talks with the Taliban.
He also met his Afghan counterpart Asadullah Khalid in Kabul and reassured him that the US military would not abandon Afghan soldiers in their battle against the militants.
"(The) secretary reaffirmed the US assistances to the Afghan Army and assured that the US will not let the Afghan forces alone and will continue its assistance to them in fields of training, equipping and counter-terrorism efforts," the Afghan Defence Ministry said in a statement.
The US and Taliban representatives held multiple rounds of talks in the United Arab Emirates and Qatar amid opposition by Ghani's government which insisted on having a central role in the peace talks. But the Taliban have refused to engage with the government in Kabul.
The visit came as US special envoy on Afghanistan Zalmay Khalilzad, who held talks with Taliban representatives lately, began a trip to Belgium, Germany, Turkey, Qatar, Afghanistan and Pakistan on Sunday.
Earlier, he hailed the US-Taliban talks as "more productive than they have been in the past", saying they made "significant progress on vital issues".
However, the Taliban have threatened to derail the negotiations unless it secures a commitment from the US about the withdrawal of foreign forces from Afghanistan.