The roster of retired military officers endorsing Hillary Clinton in September glittered with decoration and rank. One former general led the American surge in Anbar, one of the most violent provinces in Iraq. Another commanded American-led allied forces battling the Taliban in Afghanistan. Yet another trained the first Iraqis to combat Islamic insurgents in their own country.

But as Election Day approaches, many veterans are instead turning to Donald J. Trump, a businessman who avoided the Vietnam draft and has boasted of gathering foreign policy wisdom by watching television shows.

Even as other voters abandon Mr. Trump, veterans remain among his most loyal supporters, an unlikely connection forged by the widening gulf they feel from other Americans.

After 15 years at war, many who served in Iraq or Afghanistan are proud of their service but exhausted by its burdens. They distrust the political class that reshaped their lives and are frustrated by how little their fellow citizens seem to understand about their experience.