The book opens with David Balfour, a seventeen-year-old orphan from the Scottish lowlands, setting out to claim his rightful inheritance at the decaying House of Shaws. Upon arrival, he discovers his uncle Ebenezer is a miserly and murderous recluse who despises him. Instead of welcoming his nephew, Ebenezer orchestrates a treacherous plot, luring David to the coast and having him kidnapped aboard a trading brig bound for American slavery.
Life aboard the ship is brutal and lawless, marked by cruelty and the death of the wretched cabin-boy Ransome. David is kept imprisoned in the filthy bowels of the vessel until a sympathetic mate named Riach intervenes, moved by the boy's plight. The plot thickens when the brig runs down a small boat in a thick fog, rescuing a single passenger: Alan Breck Stewart, a proud, elegant Jacobite soldier carrying a belt full of gold rents meant for his exiled chieftain.
Realizing the captain and crew plan to murder Alan for his money, David warns the Highlander. Together, they barricade themselves inside the round-house and heroically defend against a mutinous crew of fifteen sailors, killing several attackers including the brutal mate Shuan. Following this bloody victory, they force the captain to steer towards the Scottish coast, where the ship ultimately founders upon the dangerous Torran Rocks near the Isle of Mull.
David washes ashore on the barren, tidal islet of Earraid, where he endures days of agonizing isolation, starvation, and despair before realizing the channel is fordable at low tide. Escaping to the mainland, he embarks on a long, arduous trek across Mull and Morven, relying on the kindness of strangers and avoiding hostile red-coats. He eventually reaches Appin, where he reunites with Alan Breck.
Their reunion coincides with a historic tragedy: Colin Campbell of Glenure, the ruthless King's factor known as the Red Fox, is assassinated on the roadside. Although entirely innocent, both David and Alan find themselves hunted as accomplices by the vengeful British military and a prejudiced judiciary dominated by Campbell adversaries. To survive, they must flee across the treacherous moors of Ben Alder.
The final stretch of their journey is a grueling test of endurance, as they crawl across open peat-hags to evade dragoon patrols before finding sanctuary in the remote mountain refuge known as Cluny's Cage. Here, the fugitive Jacobite chief Cluny Macpherson hides them while managing clan disputes. Though Alan loses their meager funds in a card game with the chief—who later attempts to return the money—they ultimately push onward, driven by the absolute necessity of reaching safety and exposing the injustices of a divided Scotland.