The compass needle aligns along the horizontal component of earth's field.
So at poles, compass needle is free to move in horizontal plane as the Earth's Magnetic Field is Vertical at poles (i.e. Horizontal Component = 0). The needle may rest in any direction.