https://www.huffpost.com/entry/history-national-anthem-sports_n_5afc9bcfe4b06a3fb50d5056:
"Historians typically point to one notable event when tracing the connection between the national anthem and sporting events: Game 1 of the 1918 World Series between the Boston Red Sox and Chicago Cubs.
It was the final year of World War I, a time when many professional baseball games featured
marching drills, live bands and other patriotic elements. Given the strains of wartime, however, Game 1 was not well-attended, and
the mood was reportedly somber.
During the seventh-inning stretch, however, the band lifted spectators’ spirits with a powerful performance of “The Star-Spangled Banner.” The New York Times
recounted the moment:
As the crowd of 10,274 spectators — the smallest that has witnessed the diamond classic in many years — stood up to take their afternoon yawn, that has been the privilege and custom of baseball fans for many generations, the band broke forth to the strains of “The Star-Spangled Banner.”
The yawn was checked and heads were bared as the ball players turned quickly about and faced the music. Jackie Fred Thomas of the U.S. Navy was at attention, as he stood erect, with his eyes set on the flag fluttering at the top of the lofty pole in right field. First the song was taken up by a few, then others joined, and when the final notes came, a great volume of melody rolled across the field. It was at the very end that the onlookers exploded into thunderous applause and rent the air with a cheer that marked the highest point of the day’s enthusiasm.
The performance was so well-received that bands played the song during the subsequent games in the World Series that year. And from then on, “The Star-Spangled Banner” was a regular feature of special baseball occasions like opening day, national holidays and the World Series.
During World War II, playing the national anthem before regular baseball games became the norm, thanks to an upswing in patriotic sentiment and technological developments in sound systems that allowed for the playing of the song without the added expense of hiring a band.
The practice spread to other sports as well. After the war ended in 1945, NFL Commissioner Elmer Layden stated his intention to make
“The Star-Spangled Banner” a permanent part of every football game.
'We must not drop it simply because the war is over. We should never forget what it stands for,' Layden declared."