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.