Horatio Spafford, a Chicago businessman, wrote this gospel song after losing most of his family when the Ville du Havre, a French steam-sailer, foundered after colliding with a freighter in the North Atlantic in 1873. Two years later, Phillip Bliss, the great Methodist hymn writer, set it to music. If you look in a hymnal, you'll note that the name of the tune is Ville du Havre.
Shortly afterwards, in 1876, Bliss was killed in a train wreck.