Edit: The OP has just now stated that the requirement was not known to students at the beginning of the course, but only added later. That is unethical: changing the rules in the middle of the course after some effort has been expended and possibly not being possible to drop without penalty.
Had that not been the case, I'd still stand by what follows here. Namely, the requirement itself is ethical, if not ideal, as long as it is part of the original course requirement.
Yes, it is probably ethical if you look at the bigger picture. On the one hand, I doubt that it is even legal for someone to require another person to sign something. But on the other hand, if you don't follow the requirements there is probably no reason they need to grant you the degree. You probably have agreed, implicitly at least, to follow all university policies when you became a student there. There is also a likely expectation that those policies will change over time.
So, you could opt out, by not returning the form. No problem. Where it goes from there is up to the university.
However, knowing that your project will be shared, prior to completing it, you have options about what you include so that nothing that is published will be an issue for you in the future. There might even be a valid educational reason for the policy. It might be intended as a goad to elicit your best work.
This is, however, a different question from asking whether it is a good policy. If you think otherwise, fight the policy itself. But try to do so in a way that isn't self defeating.
The question is a bit dicier, however, if the course is something like a required capstone course. But there, I think that an appeal to authority above the professor's might provide at least an exception. But you may need a reason other than that you don't want it published.
And, if you are working under the direction and guidance of someone else, either in a job or a university, the question arises about who is the owner of any IP.
I've assumed that this policy was made clear at this beginning of the course. Changing the rules late in the game raises a different ethical concern, of course.