I've been trying to search for the origin and meaning of the phrase "Shiver my timbers", but can't seem to find anything.
The way pirates talked and the phrases they used (or didn't) aside, we gather this from Wikipedia:
According to the Oxford English Dictionary, the expression "shiver my timbers" probably first appeared in a published work by Frederick Marryat called Jacob Faithful (1835).
After an argument over grog, Tom's father has his wooden leg (a wooden leg was occasionally called a timber in slang) trapped between some bricks and is unable to move. Tom agrees to assist him on the condition he will not get a beating.
"I won’t thrash you, Tom. Shiver my timbers if I do."
"They're in a fair way of being shivered as it is, I think. Now, father, we're both even."
In case you care not to read the above, in summary, it states that it can be attributed to Frederick Marryat, in the publication named Jacob Faithful, published in 1895.
However, Wikipedia does provide further information to help explain the formation and meaning:
The expression is a derivative of actual 18th century nautical slang, when the phrase "timbers!" or "my timbers!" meant an exclamation (cf. "my goodness!") as can be seen in Poor Jack, a song from 1789 by Charles Dibdin.
The opening phrase 'shiver my...' also predates Jacob Faithful with the following lines from John O'Keeffe's 1791 comic play Wild Oats an earlier example:
Harry: I say it's false.
John: False! Shiver my hulk, Mr. Buckskin, if you wore a lion's skin I'd curry you for this.
Shiver my timbers!
Shiver means to break into splinters or small pieces (unrelated to cold shivers). Timbers refers to the wooden parts of a ship's hull. So "Shiver my timbers!" is similar to exclaiming "Well, strike me down!"
The OED has shiver my timbers from 1834, but the oldest reference I can find is from The Tomahawk! or, Censor General of Friday November 6, 1795:
OLD SAILOR - Peace? - Shiver my timers ! what a noise ye make - ye seem to be fonder of peace than ye be of quiet.
ANOTHER OF THE GANG - Here, Citizen TH-LW-LL - here be's a man as is abusing of ye, come an lather him.
OLD SAILOR - Lather me! - Shiver my timbers ! if so be he comes athwart me - I'll soon lower his topsails for him - Here's King George and old England for ever !
MOB - Huzza &c, and Excunt.
The earliest the OED has for any nautical slang with my timbers is 1790 by Charles Dibdin in A Collection of Songs, Selected from the Works of Mr. Dibdin:
My timbers, what lingo he'd coil and belay.
This can also be found in 1789, but I found many earlier exclamations:
Split my timbers!
Plays Written For a Private Theatre (1786) by William Davies:
Start my timbers!
The Adventures of Sir Launcelot Greaves (Third Edition, 1775) by Tobias George Smollett:
The verb start has many meanings in the OED, and this was current at the time:
21. a. To cause (a material thing) to ‘start’ or break away from its place; to displace by pressure or strain. Of a ship. To suffer the starting or giving way of (a plank, etc.).
The story was first published in the British Magazine in 1760 and as a book in 1762.
Smite my timbers!
Again, in the same book (The Adventures of Sir Launcelot Greaves, Third Edition, 1775 by Tobias George Smollett):
There's a few variations of "smite my ..." in the book.
Odds my timbers!
Yet again by Tobias George Smollett, this time in The Adventures of Peregrine Pickle (1751):
Odds was a minced oath for God's, presumably in this context urging God to do something unspecified to my timbers.
The Anatomy of Swearing (2001) by Ashley Montagu catalogues Smollett's swears:
For the eighteenth century the novels of Tobias Smollett (1721-1771) afford a treasure-trove of the swearing characteristic of the century. He had served in the British Navy, lived in the Caribbean, traveled much on the Continent, and known all sorts and conditions of men; all of his novels draw heavily upon his own experiences, especially for the embellishments with which so many of his characters decorate their speech.
I'll expand my answer then:
Shiver in this context means to splinter or to break in or into pieces rather than to shudder, the more familiar definition of shiver. Timber was nautical slang for the wood comprising the hull of the ship, so shiver my timbers literally meant blow my ship to little bits.
Hundreds of years ago when ships were mainly made of wood, a cannon attack would shiver the timbers, as here from the early 1800's.
A pirate captain would obviously refer to this on his ship as shiver my timbers (although as @Kitḫ points out below, he'd probably say me rather than my).
Online Etymology Online reports that the origin of shiver me timbers is 1835, as a mock oath attributed in comic fiction to sailors.
The NOAD simply reports that shiver my timbers, or shiver me timbers is a mock oath attributed to sailors.
A shiver, or in carpentry more commonly a “shake”, is a defect in timber, a split along the grain. Roofing shingles are also known as “shakes”, as they are split from the parent timber.
Following on from the comment that shiver meant to break , it is interesting to note that the three letter root sh-v/b -r in biblical and modern Hebrew means 'to break' when used in the simple (qal) conjugation and 'to smash' when used in the Piel (strong) conjugation.