I have no record of actual pirates saying this and I'm not sure when the term became common use in any navy. With that said, it is hard to see a nautical movie from the 1930s-1960s not using the term. A variant of the phrase (shiver my timbers) is used in the classic Treasure Island, by Robert Louis Stevenson.
"I thought so," cried the cook; "this here is a p'inter. Right up there is our line for the Pole Star and the jolly dollars. But, by thunder! If it don't make me cold inside to think of Flint. This is one of HIS jokes, and no mistake. Him and these six was alone here; he killed 'em, every man; and this one he hauled here and laid down by compass, shiver my timbers! They're long bones, and the hair's been yellow. Aye, that would be Allardyce. You mind Allardyce, Tom Morgan?"
At least one source says it is an expression of surprise. Timbers were the largest main support beams for the decks and ribs of a sailing ship. Only violent movements, such as heavy seas or a collision, could cause them to shake (or shiver). This term came to be used for any deed or action that was deeply surprising to a sailor or caused great fear. I guess a landlubber's equivalent would be an event that would send "chills down one's spine" (the spine being the main support of the human body).
The only author and editor of all pages on the site. Most of what I write about is based on years of book reading on the topic. My first web page was published back in 1994.