The Pentagon's new chief, Ashton Carter, flew to Kabul on an unannounced visit Saturday to confer with commanders and Afghan leaders about the future of the American military presence in Afghanistan.