Yes, in fact, many Illegal immigrants will marry US citizens to get attempt to get legalization in the US. Upon marriage, the former Illegals would gain the benefits of a Social Security number, and then would be given the opportunity to file for a US Green Card. Filing through a Spouse is usually a good idea, since many of them do get approved.
Note: Marriage does not change the illegal status. It is always better to find a way to get them into a legal status before the marriage. Otherwise, there is a very real possibility that the alien will have to leave the country and apply for a visa in the normal way. In some cases they have to live outside the US for many months or even years to qualify for re-entry into the US. Consult an immigration lawyer for specifics, don't condemn yourself to years apart and legal nightmares.
Aggie80