The president was cheered by soldiers after he made his unannounced visit to the army base on the eve of Memorial Day, which is held to commemorate soldiers who lost their lives serving the nation.
According to the BBC, Obama told US troops in Afghanistan that America's longest war will come to "a responsible end" at the end of 2014.
He told the troops that the US intended to preserve the gains that the troops had helped win.
Obama's visit comes as the president faces criticism at home for the treatment of wounded veterans from the conflict and as foreign combat troops are set to withdraw from the country by the end of the year.
Obama had his biggest cheer from the troops for his commitment to help find jobs for veterans, and look after the wounded, which he described not as a promise but a "sacred obligation," the report said.