Some states require proof that you're lawfully in the country for issuance of a marriage license, which in many cases would simply be the presentation of a passport. As you entered legally, after marrying a citizen you most likely will be able to adjust your status on the basis of marriage. There are a lot of threads here discussing that process.
If you've overstayed less than 180 days, leaving won't trigger a period of ineligibility (although you may find that you need a visa to reenter the United States). If longer, you could be looking at a three year period of ineligibility, expanding to ten years once you've overstayed a year or more.

