The software is licensed under GPL 2.0 which shouldn’t preclude any specific type of use.
Now, there are the “Terms of Service” which are supposed to be user-editable in any Discourse installation, but due a bug currently aren’t (as far as I know this is still broken). I’m not too familiar with their contents.
Otherwise, generally, developers of software with Free or Open Source licenses, don’t have any way to specify what people do with that software.
I don’t think software should be expected to take a political standpoint. It’s not something the Discourse developers can feasibly enforce either. There’s no way they could take everyone who breaks their ToS to court.
Hosting companies on the other hand can and should take a political stand, and they frequently do. They’re in a place to effectively enforce their rules. And with your community’s own ToS and overall culture layered on top of that, you can easily decide what goes and what doesn’t.
We can’t take their freedom of speech (in their own communities) away, but we can be much, much louder than they are.
If I found out a racist or sexist forum was using Discourse I’d be disappointed but there isn’t much I could do about it besides avoiding it.
That’s the nature of software, you can’t put it out there and let awesome people use it easily without also allow less awesome causes to use it too.
I would not go out of my way to help them with support. In the past I’ve even ssh’d into people’s private installs of Discourse to help them diagnose problems. There’s no way I’d do that for a forum with toxic content. They’re on their own.
That’s what PHPBB did at their from gold release of 3.0.0. They did not provide support to illegal forums such as forums which provided warez hotlinks, Racism etc.