Whilst carry the flag is not illegal, being a member of a terrorist organisation is, and so he could have been arrested. I expect it was a mistake that he wasn't rather than any conspiracy.
I doubt whether an ISIS flag avatar would be permitted. It would be banned under the catchall rule of not being offensive, which it clearly would be.