Can the university force me to share my courses publicly online? I want to use my course material to write a book in the future
Can I rightfully refuse to use the school's platform?


TL;DR: legally, probably not, but you are still more or less in the right according to the norms of academia.

Longer answer:

This isn’t so much about rights in the legal sense. The underlying context is that there is a longstanding tradition in academia that faculty own the rights to written (and other) media they create as part of their work. This is the case in the US where these rights are pretty universally respected as far as I’m aware, and in many other countries, and is true despite the fact that legally, in the US at least, employers in general can (and, outside of academia, generally do) assert ownership of all intellectual property generated by employees in a work context.

In other words, academic institutions have quite intentionally and explicitly given up some of the legal ownership rights they are in principle entitled to. As far as I understand, the guiding philosophy here is that faculty exercise a lot more freedom and control over what kind of materials they produce compared to employees in other sectors. That means the work is regarded as being of a more personal, creative nature, and it was decided long ago that that should mean that faculty would be the owners of the work. (Note: I am talking specifically about copyright; for other forms of IP like patent rights, a quite different philosophy and different policies typically apply.)

Coming back to your question: I think you are quite right to be concerned. Your university is at the very least showing itself as somewhat deaf to these very old and well-established ideas. But can you “rightfully refuse”? Legally, that’s less clear. But it would be quite reasonable to express a concern. At my university the administration has provided reassurance to faculty that their copyright over teaching materials would be respected during the COVID-19 crisis, and we were given quite specific explanations on how our rights would be balanced against the need to deliver our teaching remotely, including providing recordings, what steps we can take to prevent students from sharing our materials, and more. Perhaps by raising the issue you and your colleagues can push your own administration to also think this through a bit more.

Let me finish by encouraging you to also adopt a more flexible and tolerant mindset. All of us are called upon these days to get out of our comfort zone and appear in online videos and recordings, use online platforms with awful records on privacy, and generally engage in activities that in normal times we might consider distasteful and privacy-violating. We do this with the understanding that exceptional times call for exceptional measures, and that the highest priority right now is to keep the lights on at our institutions. As I said, I think your concern is reasonable and probably you can reach some sensible understanding with your administration about your class materials. But while you discuss the issue with them, try to keep some perspective and not make yourself too much of a pain in the butt. As important and valid as this is, people do have worse things to worry about these days.