The central figure of speech which it is important to be aware of is the extended metaphor that runs through the whole poem. The poem is a lament following the assassination of the President Abraham Lincoln, with the "Captain" himself standing for Lincoln. Likewise the ship is meant to be the United States, and the "fearful trip" refers to the troubles of the American Civil War which is now over. Note how this extended metaphor is presented, and how it brings out the irony of the situation:
The ship is anchored safe and sound, its voyage closed and done;
From fearful trip, the victor ship, comes in with object won;
America is now "safe and sound" and firmly "anchored" in harbour, having achieved its goal of unity. It has "won" its "object." Yet, unfortunately, the "Captain" of this process lies on the "deck," dead, not able to enjoy the victory celebrations that are being enjoyed by others and the success of his efforts to bring America through the Civil War. This is the major figure of speech that it is important that you analyse when discussing this excellent poem.
If we define a figure of speech as figurative language, the poem includes metaphor and personification.
In Whitman's 1865 poem, Whitman metaphorically compares late president Abraham Lincoln to the "captain" of a "ship" that has weathered storms ("every rack") and battles, a metaphor for America during the Civil War. The poem's first stanza begins with the ship approaching port with the captain fallen dead on the deck. Since Lincoln was assassinated five days after the surrender at Appomattox, the ship is meant to metaphorically represent America heading home to its reunification after the many battles of the war, without its commander-in-chief.
In the third and final stanza, the ship has made it safely to port, but without its commanding officer alive to savor the moment of victory. Crowds gather to greet the ship, bells ring, wreaths and bouquets are offered, but even though the crowds call for the captain, he cannot hear them or share in their celebration, just as Lincoln was unable to greet the reunified nation he had steered through four years of war.
Using personification, Whitman's speaker walks with "mournful tread" because he cannot leave his beloved "captain." Still, he urges, "Exult, O shores," as he acknowledges that the country is entitled to celebrate the "victor ship" that brought the "object won"—the reunification of the country.