A question asked when someone has done something considered to be awkward, strange, and/or just plain odd.
A rather literal analogy: When on a city bus/train/subway/etc., you might meet some odd person. You might ask "Where do you get off?" as in asking what stop they get off at, wondering if they live in a neighbourhood with strange folk.
Probably not the true origin of the term, but that seems like a pretty good guess if you ask me.
Guy 1: "So yeah, I like to run around naked with a ball of wool in my hand, and my cat chases me trying to get the ball of wool. It's sooooo much fun!"
Hey, Joe-Greg-Billy-John! I can see down yer chimney from up here! Hee-yuck!
I suggest you get off my roof before I ignite your frilly, red pants, Johnny-Smithy-Jeevesy-Beau!