All available sources suggest its origin is from boxing and refers to a ring corner where assistants support boxers during breaks between rounds:

Have someone in one's corner:

Fig. to have someone supporting one's position or goals. (Originally from boxing.)

  • As long as I have Mr. Howe in my corner, I feel confident about what I have to say.

(McGraw-Hill Dictionary of American Idioms and Phrasal Verbs.)

have someone in your corner

Boxing: To have the support or help of someone. A boxer's ringside support staff – second, cut man, etc. – are in his corner, and assist him between rounds.

If someone is in your corner, they are supporting you and helping you. It's good to know that whatever happens, he'll support me and be in my corner.

  • Note: You can also say that you have someone in your corner. From words spoken after our meeting, we felt we already had Bob Uhlein in our corner.

Note: In a boxing match, each boxer is given a corner of the ring. Trainers and helpers come into a boxer's corner between rounds and give help and encouragement.

(Wikipedia)


Following Cascabel's comment I am converting a comment to an answer; I submitted it as a comment initially because I thought it was only a contribution to the discussion rather than a complete answer. However, on second thoughts I realise that dating and placing the origin of the square boxing ring probably provides as much of an answer as is possible.

Given that the practice of having the seconds in the physical corners of the square ring was widespread and familiar I believe that the expression arose naturally rather than having an identifiable originator.

This is my original comment

The square boxing ring was defined in the London Prize Ring Rules of 1838. Before that date boxing rings were rough circles either drawn on the ground or formed by spectators. Boxers had 'seconds' but there were no corners for them to occupy so 1838 is a lower bound on the the age of expression.

Interestingly the word 'second' was not confined to boxing but was also applied to the supporters of gentlemen taking part in duels as referred to in this document. I suspect that the term 'second' as applied to boxing probably came from duelling but I can't prove that.


Here is the entry for "in someone's corner" in Christine Ammer, The American Heritage Dictionary of Idioms, second edition (2013):

in someone's corner On someone's side, supporting someone. The term originated in boxing, where a fighter's trainer and assistant are in his or her corner (one of two diagonally opposite angles in a boxing ring) to provide advice between rounds. The figurative usage dates from the 1940s. [Example omitted.]


An early example of literal usage

Examples of literal use of "in [someone's] corner" appear in newspaper articles from as early as 1863. From "The Great Match: Heenan and King," in the New York Clipper (April 25, 1863):

This is but a fulfilment of the programme which we alluded to when Heenan last departed for Europe. It is quite likely that Henan and Sayers will draw immensely for the concern they travel with draw immensely for the concern [Howes' Circus] they travel with, and when the tenting season is over, it is probable that Sayers will assist Heenan in his training, and be in his corner on the day of the fight. After that important event, the two may make a tour of England, Ireland, and Scotland, and the Boy will then bring the gallant Sayers with him to this country, where a cordial welcome awaits him.


Early examples of figurative usage

Figurative usage is evidently at least a little older than Ammer supposed.

From "King Cotton Is the Redemption of Hope," in the Carlsbad [New Mexico] Current (December 22, 1922):

It goes without saying that we have been hit hard with the great drouth, the bank wreck, the slump in livestock. and the financial distress of the stockmen.

The Hope country has been tested and tried as never before and be it said to the praise and honor of the country and its people, we are still in the ring—are in our corner—and still have both mits on.

This is an explicitly boxing-related metaphorical usage and involves not someone being in someone else's corner, but someone being in their own corner. Still it marks a departure from instances literally involving boxers and their supporters positioned in corners of the boxing ring.

From "Withdrawal of Rit[c]hie Cheers Smith Forces," in the Greencastle [Indiana] Herald (June 19, 1928):

Withdrawal of Governor Albert T. Ritchie of Maryland as a contender for the Presidential nomination has cheered the [Al] Smith forces although they were confident long ago that the Maryland executive would be in their corner at the proper time.

This is a purely figurative instance and, like most of the other early instances, involves a political contest, which it equates with a prize fight.

From Muggins, "X-Ray and Sugar Candy," in the [Sydney, New South Wales] Sunday Times (July 1, 1928):

This story beats the band. Tom Walsh, whom the present Bruce Government was elected pledged to deport, has turned from strife, and preaches "Peace! Peace! Be calm," to the industrial insurgents. He has been successively derided as a Bolshevik and Sinn Feiner: yet, to-day, those who then condemned him as a dangerous firebrand, whom Australia must deport for Australia's good, are in his corner, reciting Bracken's lines, "Not Understood." Walsh stands four square and denounces his erstwhile confreres as enemies of Britain and British good; while those who yestre'en chanted "For He's a Jolly Good Fellow" now roar opprobrious epithets at him, and look upon him as a n industrial apostate and renegade. Verily, Peace hath her defeats no less disastrous than those of war.

From "On the Way" State Lottery Bill Likely" in the [Perth, Western Australia] Mirror (November 8, 1930):

The opponents of State lotteries are only a very SMALL IF NOISY MINORITY the same killjoy minority that objects to Sunday charity carnivals and mixed bathing and most other things except church. And the Upper House isn't likely to present such a lot of opposition for the temper of the people in general is obviously turning towards a State lottery.

Sir James should give it a fly. If he does "The Mirror" promises to be in his corner.

From "In This Corner..." in the [Urbana, Illinois] Daily Illini (January 20, 1933):

President Hoover and President-elect Roosevelt meet again today in one of their historic pre-inauguration pow-wows on world affairs. Both men will again have their "seconds," and, as the radio announcers say, they are both "in the pink of condition" for the battle. We do not see any need for parceling out the so-called "seconds" between the two men as if they were boxers going into the ring together, but the news services have it that Secretary [of the Treasury] Mills and Secretary [of State] Stimson are scheduled to hold the bucket and towel for President Hoover, while the President-elect has not named the man or men to be in his corner.

From Ray Tucker, "News Behind the News," in the Santa Cruz [California] Evening News (June 15, 1938):

Said one of his [Representative Homer Smith's] managers in discussing the Townsendites' trek to Thomas: "Why, we can buy those babies for two bits apiece. All they want is money. Once we give them a look at real cash, they'll be in our corner."

From Raymond Clapper, "New Deal Jolt: Numbed by McNutt Choice," in the Santa Cruz [California] Sentinel (July 15, 1939):

From all of this there is one notable exception—Secretary [of Commerce] Harry Hopkins, who is much taken with Governor McNutt and apparently is in his corner. I suspect Secretary [of the Interior] Ickes is the most critical. He probably feels it more because he has led the crusade for a third term [for President Roosevelt].


Conclusion

The expression "in [someone's] corner was in use in the context of boxing matches at least as early as 1863. It begins appearing in contexts where the usage is purely figurative no later than 1928, in both the United States and Australia. Not surprisingly, given the similarities between prize fights and political contests, early figurative use often seems to have involved elections or other political controversies.