Trump during a 2016 campaign debate criticized Republicans (probably directed at Rove, Cheney and Rumsfeld, and maybe W. Bush who served in the Texas National Guard and not Vietnam) who make the decision to send soldiers off to war without serving and taking the risk themselves.

A response was "Well, McCain served. He was a hero"

To which Trump said "I like soldiers who don't get captured."

That was clearly directed specifically at McCain for his poor judgement in general, and as it relates to his decisions to send soldiers off to war. It was conflated by those who chose to twist what was actually said into a slam at all veteran POW's. But the context is clearly not that, and it was a hilarious shot at McCain.