Upvote:5
I have not found an original historical event which covers all aspects of the background story you are questioning, but there is similarity to a story published in 1838. The link provided in the spoiler says this:
Two American teenagers took off in a sail boat, were picked up by a China Clipper, were gone two yearsβand returned to Boston with one of them in command.
The Edgar Allen Poe story The Narrative of Arthur Gordon Pym of Nantucket , 1838 has a remarkably similar beginning:
One night, the two boys become drunk and decide, on Augustus's whim, to take advantage of the breeze and sail out on Pym's sailboat, the Ariel. The breeze, however, turns out to be the beginnings of a violent storm. The situation gets critical when Augustus passes out drunk, and the inexperienced Pym must take control of the dinghy. The Ariel is overtaken by the Penguin, a returning whaling ship. Against the captain's wishes, the crew of the Penguin turns back to search for and rescue both Augustus and Pym.
If the Heinlein story isn't based on the Poe story, they may have at least had a common source. No triumphant return in two years as Captain for Pym, but there was illness and mutiny, also mentioned as part of the background story in the note on the site brought up in comments by @Steve Bird.
The Poe story's Wikipedia page says this:
Poe, who intended to present a realistic story, was inspired by several real-life accounts of sea voyages
This may relate more to materials taken from publications by Jeremiah N. Reynolds concerning scientific expeditions and hollow earth theories, and/or from Benjamin Morrell's A Narrative of Four Voyages.
There may be a common source for Poe's story and Heinlein's, but I haven't been able to come up with one. If theses stories are based on the same event, however, anyone continuing this research might focus before Poe's story was published in 1838.
This was also asked on Science Fiction & Fantasy Stack .