That depends on the visa. B-1/B-2 visa holders, for instance, are not permitted to enroll in school. But E visa holders are permitted, as long as they continue to satisfy the requirements of the existing visa. If you have a nonimmigrant status preventing you from enrolling, you will first have to change your status to M-1. Failure to do so would likely result in a violation, which means you would not be permitted to extend your stay or change status to M-1.