There is dispute both about the origin and the meaning of this odd term, which refers to an undesirable hospital patient.
Some dictionaries say it refers especially to a patient of any age who is dirty or undesirable, or somebody elderly who is suffering from dementia or confusion. However, some doctors would specifically limit it to a poor or old person with some chronic condition whose need isn’t urgent but who is keeping somebody with a more serious problem from getting treatment. The term often appears in glossaries of the sort of medical jargon that never appears, or should never appear, in patients’ notes. Much of this is created by hard-pressed medical people who use gallows humour to distance themselves enough from human suffering to remain sane. It is often said to be an acronym of “Get Out of My Emergency Room!”.
It’s more likely that it actually comes from a character played by Jim Nabor in the Andy Griffith Show on CBS television in the US in 1963-64. The name of his character was Gomer Pyle, a mechanic with a pleasant character but dim-witted, as thick as two planks, a real local yokel. From 1964 to 1970 Jim Nabors had his own spin-off show Gomer Pyle USMC, in which Gomer joined the Marine Corps. Gomer, of course, is itself an inoffensive first name of Biblical ancestry (the original was one of the sons of Japheth in Genesis).
Quite how the name shifted from the world of motor repairs and military life to medical matters is far from clear, and it’s this gap in understanding that stops more careful dictionaries from citing these TV shows as the source. However, a key influence is a book on medical life called House of God written pseudonymously under the name Samuel Shem and published in 1978. This popularised the medical sense as an acronym for “Get Out of My Emergency Room” and may indeed have invented it, perhaps on the basis of the slightly older sense of the word.