Then no problem. After he divorces, you marry, (you don't have to wait) and then you file the following forms: I-130 (Petition for family member), I-485 (application for Lawful Permanent Residency), I-765 (Application for work permit), I-131 (Application for Advance Parole - but do NOT apply for this with 180 days or more of being illegally in the U.S.), G-325a (Biographic data - one for each of you), I-693 (Medical exam that a certified doctor must fill), and I-864 (Affidavit of support). You will need to file each form with supporting evidence and appropriate filing fees. You can find these forms at www.uscis.gov/forms.
The supporting evidence that you would file would be birth certificates, marriage certificate, divorce certificates if either of you have been married previously, proof of your spouse's U.S. Citizenship, proof of your legal entry into the U.S., and financial documents of your spouse to prove their income over the last year at least.
In about 3 to 5 months after filing, you should get a work permit. About 5 to 7 months after filing you should get a marriage interview. If all goes well, a few weeks later you should get a Residency status (green card). You would not have to leave the U.S. while this is pending and if you fall out of status (you stop taking classes, etc.), you would be back in legal status once you file all the paperwork I listed above.
Please let me know if you have additional questions and please do not forget to rate my service to you (not the state of the law) as that is the only way that I can get credit for my assistance. Even after you rate the service, I can still answer additional questions for you without additional charge. If you do rate me positively, a bonus is always appreciated. If you would like to request me in the future, just go to http://www.justanswer.com/law/expert-guillermosenmartin/. Thank you!