If you are an immigrant coming to the United States for the purpose of getting married to a U.S. citizen or lawful permanent resident, then the question of whether you can use a visitor visa for U.S. entry (maybe a multiple-entry visa that you already have), or should first obtain some other type of visa, hinges on one important question: Do you want to apply for a U.S. green card after you are married?
(This is only legally possible if your new spouse is a U.S. citizen, though you'd be able to start the application process if your spouse is a U.S. lawful permanent resident.)
We will address both "yes" and "no" answers to the above question below.
Legally, there is nothing wrong with getting married while you are in the U.S. as a visitor (on a B-2 visa), if you return home at the end of your permitted stay. But that doesn't mean this is a risk-free strategy.
If you haven't yet applied for the visa, and your marriage is to a U.S. citizen or lawful permanent resident, you could have an uphill battle convincing the officer at the U.S. consulate that all you want to do is get married and then leave. Too many people before you have used visitor visas as a way of entering the U.S., getting married to a U.S. citizen, and then applying for adjustment of status (a green card), to avoid the longer process of applying for a fiancé or marriage-based visa from overseas.
And then, even after you obtain a B-2 visitor visa from the U.S. consulate, the border or airport government official (from the CBP) who greets you upon U.S. entry might not believe your intentions, and may exercise "expedited removal" powers to deny you entry and send you home. That would put an order of removal on your record, preventing your return to the U.S. for several years.
Given these risks, the safest bet is to obtain a fiancé visa (K-1) for travel to the United States. It takes longer, but your entry will be easier. And, if you change your mind and decide to settle in the U.S. after the marriage, you will have the legal right to apply for adjustment of status.
Using a B-2 visitor visa to enter the U.S. with the intention of getting married and then applying for a green card while you're there is a form of visa fraud. The visitor visa is a nonimmigrant visa, whose proper use requires entering with the intention of returning home (or at least leaving the U.S.) by the date on the I-94 Arrival/Departure Record.
This form of visa fraud can result in the immigrant being placed in removal proceedings from the U.S. rather than granted a green card.
If you come to the U.S. as a visitor and only later decide to get married, that's a different matter. You will be allowed to submit an application for a green card using the procedure known as "adjustment of status," meaning you would not have to leave the U.S. during the whole application process. But tread carefully, and consider: What are your chances of convincing U.S. Citizenship and Immigration Services (USCIS) that you weren't planning the wedding from the start?
For starters, USCIS will presume that if your marriage took place within a short time of entry to the U.S., (normally 90 days) the purpose of the entry was to get married. No matter what, it's best to wait at least 90 days before the wedding.
USCIS can, of course, look beyond the date of the marriage for other evidence of your intentions. And because you will have to submit personal documents showing that your marriage is bona fide (not a fraud or sham) as part of the green card application, this could trip you up. If, for example, you submit a letter from when the immigrant was still living abroad, saying, "Love you, can't wait till the big date in June!" you can probably forget about convincing USCIS that your intentions upon U.S. entry were not fraudulent.
Of course, if you entered the U.S. as a visitor and then met someone and decided to get married, you have a good chance of presenting a convincing case that no visa fraud was involved, and succeeding with an adjustment of status application.
But if you are still trying to figure out what type of visa to get for U.S. entry, a fiancé visa is your safest bet. For information on these visas, see Who Is Eligible for a K-1 Fiancé Visa? Or, if you're already in the U.S. and have gotten married, but worried that you'll have trouble convincing USCIS about your innocent intentions upon entry, you might want to leave for your home country by the required date and apply for an immigrant visa through Consular Processing. That will make clear that your entry to the U.S. was innocent.