William Whiting of England composed the poem in 1860 for a student of his who was soon to sail for America. The music was composed by another Englishman, Rev. John Bacchus Dykes, an Episcopalian clergyman. The music was published in 1861, but I don't know how the lyrics and the music came to be put together.
The hymn was sung at Franklin D. Roosevelt's funeral, as well as the funerals of John F. Kennedy and Ronald Reagan. And as the 1999 movie, Titanic shows, it was sung during services aboard the doomed vessel the Sunday before she sank. (However, the version sung in the movie was not arranged until 1940.)
Since the hymn was penned, a number of other verses have been composed by various persons over the years. Some of these have been adopted by the Armed Forces Chaplain's Board for inclusion in worship services conducted by military chaplains. These additional verses, prayers for the Marines, aviators, astronauts, the wounded, families at home and others, are included as an addendum on the US Navy's web page devoted to the hymn. Verses for the hymn are easy to write. The rhyming is simply, aabbcc, with each line consisting of eight syllables in iambic tetrameter (which, definitionally, is eight syllables anyway).
The original hymn itself, of course, long ago passed into the public domain, so anyone may use the music or compose a verse thereto. In my church service today, we will sing the hymn in five verses honoring all who serve at sea, on the land or in the air, finished by a verse of prayer for our country, thus:
Eternal Father, strong to save,Of the verses above, authorship is as follows:
Whose arm hath bound the restless wave,
Who bidd'st the mighty ocean deep
Its own appointed limits keep;
Oh, hear us when we cry to Thee,
For those in peril on the sea!
O Lord of hosts, to you we turn
To give us grace we cannot earn.
Our soldiers guard our way of life;
Be with them all in times of strife.
Let courage flow from your command;
We pray for those who fight on land.
Eternal Father, grant, we pray,
To all Marines, both night and day,
The courage, honor, strength, and skill
Their land to serve, thy law fulfill;
Be thou the shield forevermore
From every peril to the Corps
Lord, guard and guide all those who fly
Through the great spaces in the sky.
Be with them always in the air,
In darkening storms or sunlight fair;
Oh, hear us when we lift our prayer,
For those in peril in the air!
Almighty God, whose arm is strong,
protect us e'er from doing wrong.
We pray to always do what’s right,
for justice only be our fight.
Let peace now reign across our land,
brought to us by your gracious hand.
Verse 1 - William Whiting, the original first verse.
Verse 2 - me, composed for this day as a prayer for the Army Verse
3 - J. E. Seim, 1966
Verse 4 - Mary C. D. Hamilton, 1915
Verse 5 - me again
You can hear the US Navy Sea Chanters, the service's chorus, sing the first verse by clicking here.