schengen – I applied for a work permit while still studying. What happens if my student visa is canceled?

I do not know Czech law, but in many other countries:

It is not because your work is not paid that it is not work.

In other words, you may be breaking the law by doing your unpaid internship without a work permit. I highly recommend checking with a lawyer.

To answer your question:

Yes, if your student visa is canceled before your work permit is granted (and you do not have another permit allowing you to stay), you must leave the Czech Republic.

You should also know that a sudden change of visa can cause you problems. Depending on the time you are studying, if you suddenly decide not to want to study, but rather to find a job, the Czech authorities might think you really do not want to study at all, but rather work all the time. This may cause them to reject your work permit application.

Depending on how much time you have left in your class, you may want to finish your studies, do an unpaid "training" with your company and start your job at the end of your course.