It is worth noting that Discord is larger than the average pony. Just how much depends on a number of factors, but presuming he hasn't changed his size (which often happens) and he's standing up mostly straight (which he often is not because straight lines are boring), and you don't count his horns (which, to be honest, were yet another thing he could alter just to mess with anypony holding a ruler), Discord stood roughly four times a pony's height. That combined with his snake-like body's flexibility meant that he was both frighteningly large and able to get into spaces one wouldn't normally expect him to get into.