After all, it should be clear that no one fights purely for money; that anyone who does is probably not worth hiring. As Montesquieu put it, "A rational army would run away." To stand on the firing parapet and expose yourself to danger; to stand and fight a thousand miles from home when you're all alone and outnumbered and probably beaten; to stand fast over the body of Leonidas the King; to be rearguard at Kunu-ri; to stand and be still to the Birkenhead drill; these are not rational acts.
They are often merely necessary.
-- Jerry Pournelle, in the foreword to Hammer's Slammers
Such acts will continue to be necessary as long as men have to fight to defend their homes and lives. And science fiction, with its advanced technology and alien worlds, provides fertile ground for fictional warfare. Thus you can get military science fiction: SF with a military theme, but considerably more sophisticated than space opera. I read a lot of military SF, for roughly the same reasons I like the Hornblower saga: good drama requires conflict, and war is a very good place to find conflicts. Right now, most of my military-SF collection comes from just a few authors.