This hymn was written after several traumatic events in Spafford's life. The first was the death of his only son in 1871, shortly followed by the great Chicago Fire which ruined him financially (he had been a successful lawyer). Then in 1873, he had planned to travel to Europe with his family on the S.S. Ville du Havre, but sent the family ahead while he was delayed on business concerning zoning problems following the Great Chicago Fire. While crossing the Atlantic, the ship sank rapidly after a collision with a sailing ship, the Loch Earn, and all four of Spafford's daughters died. His wife Anna survived and sent him the now famous telegram, "Saved alone." Shortly afterwards, as Spafford traveled to meet his grieving wife, he was inspired to write these words as his ship passed near where his daughters had died.
Bliss called his tune Ville du Havre, from the name of the stricken vessel.
The Spaffords later had three more children, one of whom (a son) died in infancy. In 1881 the Spaffords, including baby Bertha and newborn Grace, set sail for Israel. The Spaffords moved to Jerusalem and helped found a group called the American Colony; its mission was to serve the poor. The colony later became the subject of the Nobel prize winning Jerusalem, by Swedish novelist Selma Lagerlöf.