It is definitely federally illegal on the grounds of sanctions [1], if not treason, to knowingly provide service to the Islamic State. Twitter's hands are tied.
If you are in a democratic country, your society has explicitly granted your government authority through your voting systems to be the ultimate arbiter and parts of it can and does get revoked as the will of the society changes.
Whataboutism. Government passing laws on free speech is unrelated to internet platforms enforcing arbitrary rules depending on the outrage mob of the week.
[1]: https://sanctionssearch.ofac.treas.gov/Details.aspx?id=8759