It depends on what made you illegal. If you entered the country illegally, then you cannot apply for a green card or a work permit based on your marriage. If you entered legally, then you may be able to apply for both a green card and a work permit. Once filed, it can take up to 90 days for a work permit application to be processed.