I've got an online discussion forum as part of a (mostly in person) university course that I'm teaching. I've been using the university-provided Blackboard forum software which is ... well, I won't use the words that I want to use to describe its quality. In the future, I'm going to use some other software for this purpose, and it won't be hard to find something better than Blackboard. However, the best forum software I've ever used is StackExchange. It's incredible. Any way I could make use of it for teaching?
No, Stack Overflow does not provide this type of service / functionality.
You could look at commercial offerings such as AnswerHub. I have no affiliation with them, but my company does use a customized version of theirs for our own support / Q & A and it works by and large the same way this site does.
They may be able to provide a substantial educational discount; I have no insight into that, but you'd have to contact them directly to get reasonable estimates anyway.
That is the one I have experience with; as pointed out in the comments, there are many others.