All nine Presidents from Harry Truman through Bush the First had served in the military. During this 47-year period all major party nominees for the presidency except Adlai Stevenson had served in the military. That includes Walter Mondale and Michael Dukakis. FDR never enlisted but had been Deputy Secretary of the Navy so you reasonably could include him too making for a 60-year streak of veteran presidents.
This requirement weakened gradually then began to lose its grip with the ostensible end of the Cold War and election of Bill Clinton. Still, subsequent nominees Bob Dole, W, Al Gore, John Kerry, and John McCain were all veterans. This tradition finally sank away entirely with the 2012 Barack Obama/Mitt Romney contest with neither candidate a veteran. After this I don't recall this criterion getting any mention at all.
In the old days the military was seen as a legitimate tool to expand the nation interest via conquering other nations. All the great powers were doing this. William McKinley had enlisted as a common soldier in the Civil War and saw a goodly amount of serious combat. Winston Churchill "saw action" as a young lieutenant. Teddy Roosevelt lost sons in World War One, this killing his enthusiasm for war. Joe Kennedy Jr. died as a military test pilot, a very dangerous duty. A great deal of hay was made over JFK's stint as a PT boat captain. As a minimum you had to have served in the military, and even so would be disfavored if you had never come under fire. LBJ made a big point of exposing himself to very serious enemy fire, though I believe it was only once.
When I was a kid the dominant ethos was the nation had to stick together and support its leaders. The military crewcut purposed to abate lice was very popular. The Beatle cut was considered subversive to national unity, it caused a huge controversy. Vietnam put a dent in this ethic, Nixon's disgrace was another blow, it faded away gradually, and by now this feeling has disappeared completely. Also having disappeared is the idea that the rich and famous should expose themselves and their progeny to enemy fire, or at the very least have volunteered for the USO. The "we're all in this together" feeling has left the building.