Laws are enforced by making some legal entity either comply to them, or be punished (via fines for example).
There's a limited extent to which laws can still be enforced on a service that's hosted outside of the countries with those laws, but the point of open source and decentralized alternatives to Discord is that they're harder for governments to force into enforcing these kinds of laws.