I think you’ll find the expression originated in the phrase, “Well, slap my ass and call me Sally.”
Sally was a common name for a mule/donkey/ass back in the day. (No, not the 1960s. I meant “back in the day,” as in the 1860s and earlier.) You got such a beast of burden moving by slapping it in the butt.
The expression was a lighthearted way of calling oneself a fool – or more aptly, an ass.