Apollo wasn't at all a military program - it was about as far from military as you could get, at that time, and still use huge rockets. And would have been a massive waste of money, if it were. There was a military space program, but Apollo was not part of it. It was a national prestige program.
> Kennedy as president had little direct interest in the U.S. space program. He was not a visionary enraptured with the romantic image of the last American frontier in space and consumed by the adventure of exploring the unknown. He was, on the other hand, a Cold Warrior with a keen sense of Realpolitik in foreign affairs, and worked hard to maintain balance of power and spheres of influence in American/Soviet relations. The Soviet Union's non-military accomplishments in space, therefore, forced Kennedy to respond and to serve notice that the U.S. was every bit as capable in the space arena as the Soviets. Of course, to prove this fact, Kennedy had to be willing to commit national resources to NASA and the civil space program. The Cold War realities of the time, therefore, served as the primary vehicle for an expansion of NASA's activities and for the definition of Project Apollo as the premier civil space effort of the nation. Even more significant, from Kennedy's perspective the Cold War necessitated the expansion of the military space program, especially the development of ICBMs and satellite reconnaissance systems.2
> Kennedy as president had little direct interest in the U.S. space program. He was not a visionary enraptured with the romantic image of the last American frontier in space and consumed by the adventure of exploring the unknown. He was, on the other hand, a Cold Warrior with a keen sense of Realpolitik in foreign affairs, and worked hard to maintain balance of power and spheres of influence in American/Soviet relations. The Soviet Union's non-military accomplishments in space, therefore, forced Kennedy to respond and to serve notice that the U.S. was every bit as capable in the space arena as the Soviets. Of course, to prove this fact, Kennedy had to be willing to commit national resources to NASA and the civil space program. The Cold War realities of the time, therefore, served as the primary vehicle for an expansion of NASA's activities and for the definition of Project Apollo as the premier civil space effort of the nation. Even more significant, from Kennedy's perspective the Cold War necessitated the expansion of the military space program, especially the development of ICBMs and satellite reconnaissance systems.2
Source: Project Apollo: A Retrospective Analysis
https://history.nasa.gov/Apollomon/Apollo.html