What are the legal requirements to marry a US citizen for a foreign person in the US on a visa permit?
Marriage requirements are the same for all people. Immigration status has no bearing on your right to marry. As long as you are not currently married and are over 18 years old, you should be able to obtain a marriage license. If you are not in the United States and you want to come to marry an American, than you will need to apply for a fiancee visa.
Note however, that if you want to apply for a green card through marriage in the U.S. after the wedding, you shouldn't be on a visitors visa, since otherwise you will have to prove that you did not enter the U.S. with an intent to get married.