I do think that the saying has a military origin, for in the early days of the British Empire, British regiments formed squares before battle, so if the opposing f force also formed squares, they could be said to be all squared up.
See the second verse of Henry Newbolt's poem, Vitae Lampada.
When I joined the RM in 1938, the drill structure was based on 4-ranks, and the most satisfying movements were forming fours, and forming two deep on the March..
Carrying out the movements always seemed to leave me with the feeling of having formed a square, and then the reverse.
It may sound a bit complicated, but I feel sure that all you clever people will understand what I mean.