The crime of bigamy, if enforced, is committed, when anyone legal or illegal, marries someone 'knowing' that they are already lawfully married to another. An illegal alien can get divorced in the U.S. just like a U.S. Citizen provided the foreigner can hire an attorney. Once divorced, a foreigner can lawfully marry a U.S. Citizen. Certainly, mistakes happen, when people think that they are divorce, but find out otherwise. Sometimes, documents are not properly entered in a court to finalize a divorce. Also, some cannot find fraud proof divorce orders. In those situations, those who cannot prove that they are lawfully divorced before marriage to a U.S. Citizen must consider seeking a divorce that is documented in a court. Otherwise, the marriage will not be considered valid.
There are also other issues. For example, a marriage to a foreigner, alone, is not enough to secure a green card, which is known as lawful permanent resident status. The applying couple must prove 'to the satisfaction of the USCIS Adjudicator that the marriage 'was entered into' based upon a good faith relationship. Marriages that are entered solely for the purposes of seeking a green card are against Federal criminal law. In addition, those who marry for a green card, if proven, can be permanently barred from civilly applying for permanent resident status. There is no waiver of that legal finding, if proven.
What this means is that if you are really in love, then get married. Otherwise, don't do anyone any favors. In addition, those who entered without inspection, that is, those who illegally crossed the border or without lawful paperwork 'often' cannot 'complete visa processing' in the United States. There are a few exceptions based upon what is called 'grandfathering in' based upon INA Section 245i.
Most will not qualify for 245i adjustment, but filing applications may get a person deported. Someone who has 'entered illegal' should seek the advice of an experienced immigration and visa attorney; there are other complications that should be discussed before filing.