Fumes from your marker likely.
I don't think anyone has ever suggested that this happens as a result of a deliberate action - but rather, that when a queen is held by the wings, her legs frequently flail about as she struggles to free herself. Then, if she should curl her abdomen and expose her sting - which now faces forward - there's a very realistic possibility of one of her back legs touching that stinger momentarily, causing the queen to 'faint'- such an event being consistent with this happening during inexperienced handling. It's possible of course that queens may 'faint' at other times for unrelated reasons.It's my opinion that the idea of the queen stinging themselves on the legs is just part of beekeeping lore, like tanging to cause a swarm to settle on a tree limb. The only documented use of the queens sting is against other queens, with a rare report of beekeepers being stung while clipping/marking queens. During the fight between virgins they are careful not to sting except in the wing-root area on the thorax.