The pirouette is most easily performed by four legged ponies (and their equally four legged bio-equine counterparts) since it entails making two circles: a small one with the hind legs inside of a larger one with the front legs (essentailly spinning around on the hind end). A pirouette consists of a full circle at the gait selected ("full pirouette"), but quarter, and half pirouettes can also be performed.
A two legged pony can emulate this by treating one leg as a front leg and the other as a hind leg, thereby extending the "front" leg, making a circle with it (spinning around on the "hind" leg). However, it should be noted that the hind feet do have to come off the ground in a manner consistent with the gait being performed (i.e. the pony cannot simply keep its hind leg planted), which makes this movement particularly challenging for two legged ponies.
A pirouette can technically be performed at the walk, trot, or canter, but the movement is typically associated with the canter (where it is the most challenging to perform).