A skin tag at the anus results from a condition called anal fissure. An anal fissure is a small tear at the anus, and results from hard stools. During healing the anal skin becomes uneven, and the result is a skin tag.
Skin tags may also occur when a person has piles. Piles are swollen veins inside the anus. When the piles become long-standing, the tissue swelling associated with the piles may extend to the anal skin, causing skin tags. This may occur even in the absence of bleeding from piles.
Anal skin tags have nothing to do with anal intercourse or STD.