Green Slime: It's as much a trap as a monster
What happens to it? Nothing, really, beyond its interaction with players and their equipment. That is its purpose in the multiverse. (Aside: I expect that a great deal of green slime ends up getting burned off once the players overcome the initial reaction / damage).
How did the green slime get up there? It happened off screen, because it moves so slowly that in game / combat / melee, its speed is close enough to 0 to be 0 for purposes of melee combat.
As you ask about any edition of the game, green slime didn't begin as a monster so much as a trap or a hazard. It was something a DM placed in a dungeon as a hazard or a trap for the unwary adventuring party in an underground / dungeon / cavern setting. The following illustration has a legend describing green slime as "neutral" and "hazard." (The picture originally appeared in the AD&D 1e monster manual, and IIRC the Holmes D&D basic book circa 1977).
Green slime in the Original Dungeons and Dragons game, was a mindless dungeon hazard
GREEN SLIME: A non-mobile hazard, Green Slime can be killed by fire or
cold, but it is not affected by lightening bolts or striking by
weapons. It eats away wood and metal but not stone. Green Slime sticks
to flesh and penetrates it in one turn, thereafter turning the flesh
into Green Slime. Green Slime cannot be scraped off, so when it
contacts something the item must be discarded or excised in some way.
A Cure Disease spell will also serve to kill and remove Green Slime,
even when it is contact with flesh. (Monsters and Treasure p. 20; TSR, Gygax and Arneson, 1974)
How much it isn't a monster like other monsters is verified by the Monsters Reference Table (p. 4 M&T): Monster Type (NA) / Number Appearing (NA) / Armor Class (NA) / Move (nil) / Hit Dice (2) / % in Lair (Nil) / Amount & Type of Treasure (Nil)
Most monsters have a value in all of those columns, other than Ochre Jellies and Yellow Molds and such, which like Green Slime are biohazards.
Moving to AD&D 1e, green slime is mostly the same but was still listed as having 0 attacks. The text has been amplified:
Green slimes are strange plant growths found in subterranean places[...]They are sensitive to vibrations and will often drop upon passing creatures from above[...]Occasionally huge slimes or colonies of dozens have been reported. (AD&D 1e MM, p. 49)
In a discussion at the dragonsfoot AD&D 1e forums, the point was that traps (of which green slime was a kind, since it just sat there waiting to drop on the unwary) were as much a test of player skill/awareness as of character ability. The feeling of fear and the dread of dungeons wasn't just because monsters were down there. The underworld was a very dangerous place all by itself. Green slimes were one way to create fear and paranoia in a party of adventurers.
I can find no record of Ed Greenwood ever doing an "ecology of" article on the Green Slime. (It's just not that interesting of a monster). Below is an excerpt from Dragon Magazine regarding green slime and traps.
With All the Trappings
A handy guide to trap design and psychology
(by Gregg Sharp, Dragon 132, p. 28)
{snip}
Active traps usually come in three basic types: biological,
mechanical, and magical. Biological traps use animals or plants as a
vital part of their mechanisms. For example, a biological trap may use
a green slime positioned above the trip mechanism so that the slime is
dislodged and falls on those passing beneath. {snip}
Previous lore has carried forward pretty consistently across editions. D&D 5e has moved green slime out of the MM and into the DMG as one of the choices for a trap. All said and done, green slime is just yucky, except that it's very dangerous to characters and their equipment.
@Dave Sherohman provided this usable-at-the-table insight, if you are interested in OSRIC or AD&D 1e compatible sources:
Astonishing Swordsmen & Sorcerers of Hyperborea has an entry for green slimes that includes the following:
- These creatures are listed with movement 0 but in fact they can move about 12 inches per day, positioning themselves
advantageously."