If you are married to a US citizen, the citizen can file a relative petition for you, as long as you have a valid marriage. The problem is that if you entered the US without papers, in most cases you will not be able to stay in the US to apply for green card based on this marriage. You will have to leave the US to file an application for a green card in your home country. If you were in the US for 6 months or longer without immigration status, you will be barred from coming back to the US for three years. If you were in the US for 12 months or longer without status, you will be barred from coming back to the US for 10 years. You may be eligible to ask that this bar be waived (forgiven), but in the past, you had to apply for the waiver from outside the US. This could mean a long separation from your husband or wife while waiting for a decision on the waiver.
In 2013, the Immigration Service changed the law to allow a husband or a wife of a US citizen to apply for a provisional waiver of the 3 and 10-year bars from inside the US. If the waiver is approved, you may only have to be outside the US for the times it takes to be interviewed for your green card in your home country. To see if you may be eligible click on Provisional Waiver.