Can an individual who is present in the United States get married while in the U.S. on a non-immigrant visa (such as a B1 or B2 visas)? The short answer is yes. There are no laws or regulations prohibiting visitors from getting married in the U.S. In fact, there have been a number of individuals who came to the U.S. on a non-immigrant visa, got married in the U.S., and returned to their home country.
Complications arise when you wish to remain in the U.S. after getting married. The B1 and B2 visas are non-immigrant visas, but in order to remain permanently in the U.S. you would need an immigrant visa. In order to do this, you could either return to your home country and apply for an immigrant visa from your country of origin, or you could attempt to do an adjustment of status while in the U.S. However, an adjustment of status requires proving to immigration officials that you originally came to the U.S. with non-immigrant intent and that your intentions changed while you were in the U.S. If on the other hand it is shown that you originally came to the U.S. with the secret intention of getting married, this could be considered immigration fraud, which could make you permanently ineligible to enter the U.S. It may be difficult to show non-immigrant intent if the marriage happens close to arrival date, because that would appear as if obtaining the non-immigrant visa was a deliberate attempt to avoid the queue of the fiancée visa or spousal visa process.
If you get married on a non-immigrant visa and then return to your home country, there is no such problem. However, a person with a multiple-entry non-immigrant visa who attempts to re-enter the U.S. after getting married may face additional scrutiny upon re-entry. In this case, you must convince officials that you do not plan to permanently move to the U.S. at this point in time, and you must show evidence that you plan to continue living in your home country for now and ultimately apply for your immigrant visa there. For example, you may show that you still have ties to your home country (e.g. you still have a job, a home, or significant personal property in your home country).