During the pirouette the horse has to make very very small steps with every hindleg and should never turn on a placed leg. This is indeed not good for the joints and therefore not wanted at all...
But the horse doen't straighten his body during the pirouette when a hindleg is on the ground - he keeps turning. Indeed it's not as with the western riding spin when the horse puts one hindleg on the ground all the time, but a horse doing a pirouette does rotate his body above hindlegs that stand on the ground for a while before being lifted.
A few years ago in the Netherlands a magazine (Bit) had asked a few vets to analyse video footage to compare western riding and dressage on several exercises (amongst which the pirouette and the spin), and when I recall correctly the vets told that the pirouette was the hardest exercise on the horses'legs because the horses's body keeps turning and every now and then a hindleg bears the bodyweight alone while being turned on. The spin was less hard when I recall correctly because the horse just locks that leg from pelvis to hoof and uses it as a standpost to stut his weight with - while in the pirouette the hindleg bears the weight right on top of it due to the collection and slowness of the movement and it has to bend it's joints while turning too, which puts more pressure on them.
Of course it's all in moderation: If you spin/pirouette all day long, your horse will gets into problems, but if you ask it only once a week or something like that, or more in walk than in canter, or canter instead of the pirouette slightly larger travers-voltes, it puts much less strain on the legs.