Hello,
Ilegal aliens can get permanent residence status (often called the "green card") by marrying a US citizen or permanent resident alien. If the person originally entered the United States legally but overstayed his or her visa, than it may be possible for him or her to "adjust status" to that of a permanent resident (i.e. get a "green card") if the US citizen or permanent resident alien completes a series of petitions including one that proves that the US citizen/ or green card holder can financially support the illegal alien.
If the alien is illegal because he or she snuck into the United States without any visa or permit, than that person cannot "adjust status" and has to leave the country before obtaining a green card. If the person was illegally in the country for more than a year, than he or she is barred from ever coming back for 10 years (known as the "10-year-bar") The only way to overcome having the 10-year-bar is by the US citizen/green card holding spouse filing a petition for a waiver of the bar. The petition has to prove that it would cause extreme and exceptional hardship to him or her to move to his or her spouse's country. Only three years after the person has the green card can they apply for citizenship, and they must still be married to the original citizen who got the green card.
My suggestion would be to consult with an immigration attorney.
USCIS