A wedgie is a slang term for a condition where one's underpants are drawn up and wedged (crammed) between the two halves of the person's rear end (buttocks).
It can happen with normal wear, but it can also happen if someone sneaks up behind, reaches into the victim's pants and pulls up hard on his/her underwear.
The image is one of someone being made very uncomfortable in a very embarrassing way.