How is banning such events constitutional with the freedom of
The rights created by the First Amendment are not absolute. They are subject to reasonable restrictions as to time, place and manner, especially if those restrictions are content neutral.
Restrictions narrowly tailored to protect against genuine threats public health and safety fall within the exception of the First Amendment even if they are not strictly content neutral, that is commonly described by the rubric that you don't have a right to falsely cry "fire" in a crowded theater (causing a riot that could harm people).
For example, suppose that a rope bridge over a deep gorge can only support the weight of ten people, and three dozen people want to hold a protest there. A regulation that prohibited more than ten people from engaging in the protest would be constitutional.
Even then, however, a lack of content neutrality (e.g., restricting punishment to false statements likely to incite a riot) can't also be a lack of ideological neutrality (e.g. restricting punishment to anti-Catholic but not anti-Jewish statements likely to incite a riot).
If it were a political protest/gathering would this change?
Generally speaking political protest/gatherings are still subject to content neutral regulations of time, place or manner, and those narrowly tailored to protect genuine threats public health and safety.
So, for example, if there is a genuine COVID-19 risk that public health officials are trying to address, and the regulation of gatherings is not viewpoint or content based, it would be upheld as constitutional in the face of a First Amendment freedom of assembly limitation.
But, if the regulation applied, for example, only to Republican and not Democratic party protests or gatherings, which is a viewpoint or content based restriction, it would not survive a First Amendment freedom of assembly challenge.