The music was originally written about 1856 by William Steffe as the spiritual “Canaan’s Happy Shore”. A Vermont man; Thomas Bishop used the tune to set the words of “John Brown’s Body”, which was used by his Massachusetts unit for a marching song. Julia Ward Howe was at a public review of troops near Washington when she first heard the song. Reverend James Freeman Clarke who had escorted Howe to the review suggested she should write new words for the song.
Howe was staying at the Willard Hotel in Washington, DC on the night of November 18th 1861, when she claimed to have awoken with words of the hymn in her mind. She remember writing the lyrics this way, “I went to bed that night as usual, and slept, according to my wont, quite soundly. I awoke in the gray of the morning twilight; and as I lay waiting for the dawn, the long lines of the desired poem began to twine themselves in my mind. Having thought out all the stanzas, I said to myself, 'I must get up and write these verses down, lest I fall asleep again and forget them.' So, with a sudden effort, I sprang out of bed, and found in the dimness an old stump of a pen which I remembered to have used the day before. I scrawled the verses almost without looking at the paper.”
“The Battle Hymn of the Republic” was published February 1862 in The Atlantic Monthly.