On Sept. 13, 1814, with the United States at war with Great Britain, lawyer Francis Scott Key and an American prisoner exchange agent were sent to negotiate a prisoner release with the British Navy. While there, the two learned of an imminent attack on the city of Baltimore and were held captive while nearby Fort McHenry was bombarded.
Inspired by the eventual American victory -- and the sight of the flag still waving at sunrise -- Key wrote a poem entitled "The Defence of Fort M'Henry." After returning home, he showed the work to his brother, who decided to set it to an old British melody -- and "The Star-Spangled Banner" was born.
The song became increasingly popular over the 19th century, and began to pop up at parades and Fourth of July celebrations. In 1889, the Secretary of the Navy, Benjamin F. Tracy, stipulated that the song be played at any raising of the flag, and in 1916, President Woodrow Wilson signed an executive order formally declaring it America's national anthem. It wouldn't become a staple of the country's sporting events, though, until the 1918 World Series, thanks to an impromptu recital during the seventh-inning stretch.
With the nation embroiled in World War I, the 1918 World Series between the Cubs and Red Sox began under a dark cloud. It remains the only Fall Classic played entirely in September, after president Wilson's "Work or Fight" order (requiring all able-bodied men to either serve in the military or work in a "necessary" civilian occupation) brought a premature end to the regular season. Some even wondered why the Cubs and Red Sox were still playing at all, rather than enlisting, and players threatened to boycott in the face of lower-than-anticipated gate receipts.
And then, in the middle of the seventh inning of Game 1 at Comiskey Park (Chicago's home games were moved from Wrigley Field to Comiskey because it could seat more fans), a band managed to bring everyone together. From the Sept. 6, 1918, edition of The New York Times:
While fans got up and stretched, the Naval Training School Band -- which frequently attended Cubs games and even had a recruitment booth stationed at Wrigley Field -- struck up the national anthem, and immediately, both fans and players stood to attention.
Red Sox owner Harry Frazee, not about to let his franchise get one-upped, had something special planned as the series shifted to Boston: He hired a band to play "The Star-Spangled Banner" before all three games at Fenway Park, and the crowds kept loving it. From that day on, the anthem rang out on Opening Day, special occasions (like Independence Day) and the World Series -- and during World War II, when all Major League ballparks boasted public announcing systems, the tradition of the anthem before every game began.