I believe it is primarily an American phrase, used as an exclamation:
Heavens to Betsy, no! I would never do such a thing!
What is the origin of that phrase? Do we know who Betsy is?
Charles E. Funk suggests that its origins are "completely unsolvable."
I am of the opinion that the phrase is pseudo-profanity derived from "Hell's Bells", but there is no evidence of that, either.
Dictionary coverage of 'heavens to Betsy'
Christine Ammer, The Facts on File Dictionary of Clichés, second edition 2006) has this brief entry for "heavens to Betsy":
heavens to Betsy An expression of astonishment, This version of FOR HEAVEN'S SAKE, which Charles E, Funk liked well enough to use as the title of one of his books [published in 1955], comes from nineteenth-century America and first appeared in print in 1892. It may be dying out.
Robert Hendrickson, The QPB Encyclopedia of Word and Phrase Origins, fourth edition (2008) contributes this assessment:
heavens to Betsy! No one has been able to uncover the origins of this old exclamation of surprise, joy, or even annoyance. Etymologist Charles Earle Funk tried hardest, devoting several pages to the expression in his book of the same name. "Possibly the phrase was known in Revolutionary War days," he writes, "but I doubt it. Nor do I think, as some friends have suggested, that it pertained in any way to the maker of the first American flag, Betsy Ross. It is much more likely to have been derived in some way from the frontiersman rifle or gun, which, for unknown reasons, he always fondly called Betsy. However, despite exhaustive research, I am reluctantly forced to resort to the familiar lexicographical locution 'Source unknown.'"
Funk's reference to Betsy as a familiar name for a frontiersman's gun finds support in Mitford Mathews, A Dictionary of Americanisms on Historical Principles (1951):
betsy, n. 1. (cap) A popular colloquial name for a favorite gun. Also old Betsy. [First cited occurrence:] 1856 Spirit of Age (Sacramento) 4 Nov. 3/1 Jest let them raise that check agin me and if I don't shoot why old Betsy won't blizzard.
The second meaning of betsy given in this dictionary, by the way, is as a short form of betsy bug, meaning "pinch bug" (a term that referred to earwigs in south Texas, where I grew up).
Harold Wentworth, American Dialect Dictionary (1944) has this for "heavens to Betsy":
Heavens to Betsy! 1914 Maine, n[orthern] N[ew] H[ampshire]. Current. Common among women.
Wentworth's entry essentially reproduces the note on the phrase in "Rural Locutions of Maine and Northern New Hampshire," in Dialect Notes (1914). A subsequent item in Dialect Notes (1917) asserts that in New England the expression may occasionally be rendered as "heifer to betsy" or "hevings to Betsy." And E.C. Hills, "Exclamations in American English" in Dialect Notes (1924) lists "heavens to Betsy" as an exclamation of "surp[rise]."
Early in-the-wild instances of 'heavens to Betsy'
The earliest instance of this expression that I've been able to find is from "Readables" (a series of unrelated brief humorous observations) in the Fremont [Ohio] Weekly Journal (July 22, 1870):
Heavens to Betsy, but wasn't it hot sparking last Sunday night. At least those who tried it said it was.
The earliest Google Books match for the exact phrase is from "Cal Culver and the Devil" in Harper's New Monthly Magazine (September 1878):
“Why, hain't you got cash enough? I thought she had rents out o' the housen in Har'ford?"
“Heavens-to-Betsy! You don't think I ever see a copper o' her cash, do ye? It's trusted out to a bank in Har'ford quick as lightnin'. It don't never peek at Bassett; and ef it did, I shouldn't have none of it."
I don't detect anything in the two quotations from the 1870s (cited above) to suggest who or what the original Betsy was. The expression clearly goes back much earlier in print than Ammer thought it did just a decade ago—but then Ammer didn't have book and newspaper databases to consult.
The sense of "Heavens to Betsy!" doesn't appear to be all that different from "Land sakes!" or "Heavenly days!" If you were going to pull a woman's name out of the thin air in the middle of the 1800s to express surprise, "Betsy" would seem to be as good a bet as "Molly" or "Aggie" or "Annie." But whatever name you chose, people 150 years later might very well be knocking themselves out trying to identify the original person of that name who inspired the expression.