You really want to allow anyone who registers to choose for themselves whether they are a student or teacher?
I hope you have fully considered the security implications of that - people who are supposed to be students having access to gradebook and other students' results, being able to edit all the content etc etc...
Also, roles such as student or teacher are generally given within a course and not on a site-wide basis, which is what you would appear to be trying to do by setting them through a user profile, so not only would the self-proclaimed 'teacher' have access to course books and editing on the course you want them to enrol on, but potentially to every course on your site.
The easiest way to prevent a user editing it on the profile settings page would simply be to use css to hide it so they cant see it anyway. Other than that I suspect you are into some significant core code hacking as I am not aware of a way to make user profile fields appear as role dependent (unless someone can correct me on that and i can learn something new )