"The Secret Sharer" begins with the anonymous narrator — the recently appointed captain of an unnamed ship — anchored in the Gulf of Siam (what is now called the Gulf of Thailand). As the Captain stands on the deck, alone, he soaks in the sunset and silence of the sea. He feels like a stranger to his new command, the ship, and his crew.
At supper that night, the Captain remarks that he saw the masts of a ship that must be anchored inside a nearby group of islands. The Second Mate tells him that the ship is the Sephora, from Liverpool, carrying a cargo of coal. As a goodwill gesture toward the crew, who have been working hard the last two days, the Captain announces that he will take the anchor watch until 1:00 a.m., something usually not done by a ship's captain.
During the anchor watch, while the hands are asleep, the Captain begins to pull in the rope side ladder, which was lowered for a tugboat man to come on board and deliver the crew's mail. When he begins to pull it in, he feels a jerk in the ropes, and surprised, leans over the deck to investigate. He sees a naked man in the water, holding the bottom of the ladder. The man introduces himself as Leggatt, and the Captain fetches him some clothes (one of his sleeping suits). Leggatt explains that he was the Sephora's chief mate and that he accidentally killed an insolent fellow crewman seven weeks ago. The Captain takes him into his stateroom and further learns that Leggatt was kept under arrest in his cabin until he escaped and swam to the rope ladder where the Captain discovered him. He sank his clothes so the Sephora's crew would think he had committed suicide by drowning.
The Captain feels an unexplainable affinity to Leggatt, often referring to him as "my double" or "second self." The Captain tells Leggatt that he has only been in charge for two weeks and feels as much of a stranger on the ship as Leggatt himself. He agrees to hide Leggatt in his stateroom.
The Sephora's captain soon arrives in his search for the escaped murderer. He searches the ship, but Leggatt remains hidden, thanks to the maneuverings of the Captain. The Sephora's captain states that he will have to report Leggatt as a suicide when his ship arrives home. The Captain and Leggatt share their relief at not having been caught.
As the Captain's ship begins its voyage home, the Captain grows more nervous about the possibility of the crew discovering Leggatt on board. On the fourth day out, the steward almost stumbles upon Leggatt when he delivers the Captain's coat to his stateroom. Leggatt tells the Captain that he must maroon him amongst some islands, because he knows he cannot return to England and face prison or the gallows. The Captain reluctantly agrees.
As the ship approaches Koh-ring, an island, the Captain orders the crew to steer the ship close to the shore. They protest that such a move is unsafe, but the Captain is determined to give Leggatt a chance to swim to safety. After stealing away to his stateroom and shaking Leggatt's hand, the Captain continues to have the ship steered close to the shore, despite all the protests of his terrified crew. Leggatt jumps off the deck and swims to safety, the Captain successfully maneuvers the ship out of danger, and wishes Leggatt luck in finding his "new destiny."