There are some etymological websites that argue the actual origin is unknown, however, others claim that “Most origin stories of the phrase claim it came from British and American naval ships of the 1700 or 1800’s. There are two versions of this story. The most common claims that sailors aboard ship had their meals served to them on square wooden trays or plates, that they either carried back to their bunks, where the plates could be stored easily, or that were stored elsewhere.
Since they only used these squares when they were getting a full meal, probably dinner, the phrase ‘a square meal’ came to be associated with a full and satisfying dinner. Another variation on the naval story has it that plates would be set on wooden squares upon the galley table to keep them from sliding off, and that at some point the squares were permanently nailed down.”