The military's space budget is much larger than NASA's
so I doubt you have to worry too much about NASA being diverted to military purposes. NASA has always done aerospace work that benefitted the military, including such technologies as fly-by-wire and advanced aerodynamics. Some of the NASA technology development has also been used by the military, things like materials, communication satellite technologies, systems, etc. Really, I just don't see NASA's resources being diverted to the war effort unless directed by Congress.
