It's a mock oath ascribed to sailors, though it appears to be a comic embellishment of a slightly different oath, my timbers. The latter dates from the late 18th century, while shiver me/my timbers is first recorded in 1835: "I won't thrash you Tom. Shiver my timbers if I do" from Frederick Marryat's Jacob Faithful. Apparently Mr. Marryat invented the phrase with an eye toward avoiding his readers taking offense at stronger words. It's also possible that my timbers was invented, for it first appears in a song: "My timbers! what lingo he’d coil and belay."