A DiscreditedHigh School trope that is not disappearing any time soon. Every Jerk Jock has done it to the Ordinary High-School Student at least once. Even an Alpha Bitch or two has done it to the Na´ve Everygirl.
If this has ever been done in real life, it must have been during a time before schools were as crowded as they are today and lockers were bigger. So writers, who are almost all well into their thirties regardless of the show's target demographic, may have grown up seeing stuff like this. Many still think it's what kids do today. Or perhaps a really old High School show once did it because the director thought it'd be funny and everyone else followed suit. Who knows.
Chances are, it did happen once or twice, but it could also have originated as a joke, since larger lockers were commonplace in older school buildings. However, today, schools are built to accommodate a higher volume of students, and stacked lockers are more common. Older buildings may still have the larger lockers but these are often ditched during remodeling.
Not to be confused with Stuffed into the Fridge, aside from establishing how much of a jerk/monster the stuffer is.
Inazuma Eleven: Kabeyama tries to hide himself in a locker, so he doesn't have to play a soccer match, but he ends up getting stuck in it due to his large body size.
This happens in All-Ghouls School, with the bullies stuffing a freshman into the heroine's locker. This is apparently a regular occurrence, with the bullies keeping track of who has the record for the longest time it take for a freshman to be released. Later, Becca gets stuffed into a locker by Elle at Darkmoor.
At the beginning of Lean on Me, a pair of bullies stuff Thomas Sams into a locker (which is somewhat remarkable in itself, since Sams is rather fat) and walk away. Then, to drive home the point of how much the conditions at East Side High had deteriorated in the 20 years of Joe Clark's absence, a janitor lazily walks down a hall that intersects the hall with Sams' locker while reading a newspaper. Sams is screaming for help, and despite the screams being very audible in the empty hallway (the school day had just ended), the janitor completely ignores them.
Happens in Sky High, to the kid who can glow. In fact, the only reason you know he's in the locker is that it's glowing bright green.
In the film, Man Of The House, the protagonist meets one of the other kids when said kid is stuffed into a locker while the protagonist does nothing. Never the end of the movie, having bonded, he takes a stand against the bullies. Cut to a shot of the outside of the lockers with the two of them conversing from within the closed lockets.
Live Action TV
In Saved by the Bell, Screech apparently has built a labyrinthine series of secret passages throughout the school lockers.
Abed: It's where I spent a lot of time in junior high. Annie: You think that's where we'd put you? You know that's absurd, right? Abed: Well, I'm not stupid. You can see I've increased the square footage; it's a metaphorical locker. It's a place where people like me get put when everyone's finally fed up with us.
Super Human Samurai Syber Squad: It happened twice to Malcolm Frink. The first time was at the end of "Que Sera Servo", where Malcolm was taking advantage of the heroes having their personalities altered and they did this to show they were back. In "Mal-Khan-Tent", it wasn't Malcolm himself but Kilokhan in Malcolm's body and Sam and Tanker locked him away until they could find and rescue Malcolm. However, since Malcolm's body was still in the locker when he returned, he felt what's like.
Played with in the My Chemical Romance video for 'I'm Not Okay'; a teen gets shut in the locker, and uses his position to jump out and scare the locker's owner.
Also reversed in this one, where a bully get a locker stuffed into him. That's gotta hurt.
Referenced (but not depicted) in The Wotch to justify Robin and Jason's decision not to inform Anne that her personified feminine pride had gender bent Tandy Garden High's worst jerk jocks into four "honest and kind" cheerleaders.
Similarly, the nerds at Springfield Elementary in The Simpsons are shown to have a secret clubhouse/base hidden within the lockers.
In another episode, Lisa attempts to find common ground with a bully, only to end up...you guessed it.
Lisa: How about jazz? Do you like jazz?
Milhouse: I like jazz.
Lisa: Milhouse? She got you, too?
Milhouse: Yeah, but it's not so bad. I'm standing on Ralph.
Ralph: We're a totem pole. (hops up and down chanting)
In an episode of Clone High, JFK boasts of stuffing the entire freshman clsss into only ten lockers. And in another episode, Abe, having gone without sleep for almost a week, stuffs himself into a locker (and since Abe was six-foot-four, he was folded like an accordion).
X-Men: Evolution did this in the second episode, with Kitty Pryde as the target. Naturally, this was a setup for her to discover her phasing power, and not coincidentally, run into Avalanche, who was the episode's main villain.
In the Transformers Animated episode "Autoboot Camp", Bumblebee was stuffed into a locker by Wasp and Ironhide for getting them in trouble to Sentinel Minor. Right after removing his legs.
In an episode of King of the Hill, one student who's been scaring Bobby by sneaking up to him managed to hide inside Bobby's locker for the next scare.
The Fairly OddParents: In a similar fashion to the above example, Denzel Crocker hid inside Timmy's locker in "Mind Over Magic" for a pop quiz. Francis the bully later shut the locker door to interrupt Crocker's rant about Fairy Godparents.
In "Just Desserts", Timmy wished all meals on the world were desserts. Almost one month later, everyone was overweight except for Mark, who, like all Yugopotamians, only eats healthy food for dessert. The bullies decided to stuff him in the locker because Mark was the only thin one. However, a near-whole month of eating nothing but desserts made the bullies so unhealthy their would-be-victim didn't even need to walk any faster to escape.
RWBY: Team Cardinal is the bully gang of the year group and Jaune Arc is one of their victims. At one point, Cardin Winchester stuffs Jaune into a locker. However, since Beacon is an Extranormal Institute that is run by an acknowledgedexpy of the Wizard of Oz, the locker is actually rocket-propelled with programmable coordinates. Not only does Jaune have the issue of trying to get out of it, but he has to then make it back to the school from where the locker landed.
Some full-height lockers had a latch on the inside which would allow anyone this might happen to (regardless of how often it really did happen) to easily escape, presumably after the bullies have left.