The group infused pro-IS profiles with rainbow images and LGBT slogans.
The hacks follow the recent shooting at a gay nightclub in Orlando, where 49 people were killed by a gunman who reportedly stated his allegiance to IS.
A hacker known as WauchulaGhost, who is affiliated with Anonymous, said he was behind the hacking.
The hacker posted explicit pornographic material on some of the accounts, and in some cases, inserted a new Twitter handle, "Jacked by a Ghost".
WauchulaGhost said he had infiltrated more than 250 IS-linked accounts over the past month, posting gay pornography.
But after Sunday's shooting, he switched his focus to posting messages of gay pride.
"You had all those innocent lives lost. I just felt there's something I could do against the Islamic State to defend those people," WauchulaGhost told CNN.
The Orlando gunman, Omar Mateen, did not have a clear link to IS, according to US officials.
In phone calls to the authorities from the nightclub, Mateen said he was carrying out the attack for IS but he also pledged allegiance to a suicide bomber for the Nusra Front group in Syria, and to the perpetrators of the Boston Marathon bombing, none of whom is linked to IS.
Many of the hacked accounts were suspended by Twitter, but three profiles appeared to still be online on Friday, under the control of WauchulaGhost.
Anonymous, which was founded in the 4Chan forum in the late 2000s, began waging an online campaign against IS in 2015.
The group seized control of dozens of Twitter accounts linked to IS after the attacks on the offices of the satirical magazine, Charlie Hebdo, in Paris last year.
Hacker-activist group Anonymous has broken into Twitter accounts linked to so-called Islamic State (IS) and flooded them with gay pride messages.