As a foreign national living in the U.S. after entering illegally, your marriage to a U.S. citizen might not, unfortunately, create a straightforward path to a U.S. green card (lawful permanent residence). U.S. immigration law has created various penalties for people who both enter and stay in the U.S. without permission.
We'll explain the problems here. The penalties you might face partly depend on how many times you crossed the U.S. border without permission or inspection.
You should definitely see an attorney about your hope to immigrate based on marriage to a U.S. citizen if you have entered the U.S. without inspection two or more times and
Such would-be immigrants might be permanently "inadmissible" to the United States. It doesn't matter that they are married to a U.S. citizen. The only thing they can do is to wait ten years since they last left the U.S. and then hope the government will allow them to apply for the opportunity to come back. See The Permanent Bar to Immigration for Certain Repeat Violators.
If you have entered the U.S. without inspection only once, or your previous illegal entries and stays total less than one year, here are your choices.
As the spouse of a U.S. citizen, you are known as an "immediate relative." This is true whether you are in an opposite-sex or a same-sex marriage, provided your marriage is legally valid in the place where it happened.
A green card is theoretically available as soon as you can get through the application procedures.
Unfortunately, unless you fall into a rare exception (discussed in When Adjustment of Status Is Possible for the Immigrant Spouse of a U.S. Citizen), you will not be allowed to apply for your green card at a USCIS office in the United States.
But if you leave after living here illegally for more than six months, you risk having the consulate punish you by refusing to let you return to the U.S. for three or ten years, as discussed in Consequences of Unlawful Presence in the U.S.—Three– and Ten-Year Time Bars.
To avoid being punished by the time bars, you need to act carefully and quickly. You have three options to consider:
CAUTION
Make sure you can prove that your unlawful U.S. stay lasted less than six months. When its time to apply for your immigrant visa at a U.S. consulate, the officer will want to see proof of how long you stayed unlawfully in the United States. Collect and keep all evidence, such as your plane tickets, store receipts, medical records, credit card statements, and anything else relevant to show your dates of stay and departure.
For questions on any of this, and help with the challenging task of preparing a waiver application, consult an experienced immigration attorney.