Project may be benefitting a professor's personal company
Assuming the professor's intentions are indeed as presumed, I think this is a problem for two reasons:

The students did not consent to being used as workforce.
Regardless of the extent of their contribution to the final product, the forced use of any uncompensated workforce means somebody who is qualified to get hired and do the job  will not be getting hired, removing jobs from the market.

From a legal point of view, the professor may have every right to do what he is doing. If not, that is a problem on its own, and has been addressed in @Spark's answer. Otherwise, all the secrecy surrounding the matter was not necessary, and had he been more transparent, I highly doubt that any of the students would refuse to do the assignment.
For reasons of my own, this reminds me of the consent crisis surrounding pelvic exams performed by medical trainees on women under anesthesia. Perhaps since decades, it was considered ok for medical students and trainees to do such pelvic examinations. However, when the recipients found out about it, they felt exploited. Same here. There is a very fine line here: most women actually tend do provide consent to such practices if discussed prior to the procedure, but when found out about it afterwards, most find it shocking. The professor could have been more transparent, which would have had the additional benefit of helping the students feel not violated.
As an example supporting my latter point: in the United States, most universities typically have policies to limit the voluntary presence and participation of visiting scholars from other countries in research activities. This is because there are plenty of talented individuals from other countries who are ready to pay out of pocket to come to the US to progress their careers. It is easy for a primary investigator to run their lab relying on this freely acquired talent and preserve their grant money for other things. However, this prevents everybody (US citizens and foreigners alike) from actually getting paid research positions in labs. Policies as such aim to prevent this from happening and is for the benefit of everyone.
As far as you are concerned, some of you who graduate from your class may be potential employees for the professor in question, and if he keeps getting things done with free talent like yourselves, well, he will be needing you less. Future employment may be a very valid concern to approach your professors with.