Does the "pot" refer to porcelain toilets, or does it refer to the bedpans used before that?
The two earliest examples of the expression I can find on google ngrams are in a 1942 novel by Ward Moore called Breathe The Air Again, and in the 1951 novel From Here To Eternity by James Jones (which was turned into the 1953 movie of the same name starring Monty Clift and Frank Sinatra etc). Ward Moore would later become more prominent as a science fiction author, but Breathe The Air Again is a sort of prototype Beat travel narrative with socialist overtones. In the Ward Moore book, the phrase is used idiomatically:
"Aw, shit or get off the pot," admonished Pylon, "we'll be in Sacramento by the time you're through studying them cards."
From Here To Eternity was a book based on the author's war experiences in Hawaii immediately before the Pearl Harbour attack, and the author put the idiom into the words of Sergeant Leva:
"Goddam it," Leva cried indignantly, "if I don't take it, that guy in the 21st will. That's how Gilbert put it to me. I either got to shit or get off the pot."
Another early use of the phrase comes from Richard Nixon, who as Eisenhower's Vice Presidential candidate in 1952 was at one point mired in scandal after a New York Post headline titled 'Secret Rich Man's Trust Fund Keeps Nixon In Style Beyond His Salary'. According to Dwight D. Eisenhower by Tom Wicker, Eisenhower was vacillating over dropping Nixon from the ticket, and Nixon reputedly told him at the time to "piss or get off the pot".
Given the military background of both Nixon and Eisenhower, and given the military setting of From Here To Eternity (and the famously profane nature of much military slang), the idiom likely originated from the US military. It probably also probably originated somewhat before World War II (given that Ward Moore doesn't seem to have a military background, but presumably interacted with men who did). And given that the US military presumably experienced a variety of toiletary conditions, I'd guess that 'pot' was used as a sort of all-purpose word in this instance; the point in the idiom is more the communal use of the 'pot' leading to queues/demand for its use, rather than the exact nature of the 'pot'.