Christine Ammer, The Facts on File Book of Clichés, second edition (2006), offers this entry:
square meal, a A substantial and nourishing repast. A mid-nineteenth century Americanism, the term appears in humorist Stephen Leacock's Literary Lapses (1910): "Any two meals at a boarding house are together less than two square meals."
One astute 19th-century commenter, Maximilian Schele de Vere, Americanisms: The English of the New World (1872) has this to say about "square" (squarely) and "square meal" (glancingly):
Square, either as an adjective qualifying a noun, as "a square trade," or as a phrase, on the square, refers to the open, fair character of a transaction. In either case the metaphor is borrowed from the Masonic emblem, the square being the symbol of evenness and rectitude. Thus all squares is used in Pickwick Papers, p. 434. "It ain't no square game. They've jest put up the keerds on the chap from the start." (F. B. Harte, Preface to Luck of Roaring Camp, p. 1.) "Can you give us a square meal?" "This is all a fair, square, bona fide (fide to be pronounced as a monosyllable) business enterprise, is it? (Putnam's Magazine, August, 1868.)
Among the earliest definitions of the phrase is this one from a glossary of "Californianisms" included in John Hittell, The Resources of California, Comprising Agriculture, Mining, Geography, Climate, Commerce, Etc. Etc. (1863):
Square Meal, a good meal at a table, as distinguished from such meals as men make when they are short of provisions, a condition not uncommon among men who make adventurous trips into the mountains.
So it's not surprising that perhaps the earliest Google Books match for "square meal" occurs in "The World in California," in Hutchings' California Magazine (February 1857):
He ["the Miner"] almost invariably attends church on Sunday, or visits some city, town, or village where there ought to be one,—and though he seldom works on that day, his presence in town makes everybody else work. His weekly supply of "grub," and his one "square meal" on Sunday, he will have ; picks must be sharpened, and his boots made thicker on their bottoms; ...
Several other authors writing in the 1860s (including Mark Twain in The Innocents Abroad [1869]) report that "square meal" is native to California, so perhaps it really was.
An Ngram chart of the frequency of "square meal" from 1850 to 2005 shows a gradual decline since roughly 1920:

but I agree with the commenters above who say that the expression remains fairly common in informal U.S. English.