A mild exclamation of surprise.
This American phrase has been in circulation since the latter part of the 19th century, although its use faded throughout the 20th century and it is now something of an anachronism. The first example of it that I can find is in Rose Terry Cooke's book of short stories Huckleberries Gathered from New England Hills, 1891:
'Heavens to Betsy!' gasped Josiah.
Of course, what we would like to know is who Betsy was. Various theories have been put forward but it is unlikely that she will be identified, if indeed Betsy ever was a real person - which seems doubtful.
The etymologist Charles Earle Funk published Heavens to Betsy! and other curious sayings in 1955. In that he ventured the opinion that the origins of 'Heavens to Betsy' were "completely unsolvable".