Yes, you can apply for a marriage-based green card if you got married while on a tourist visa, but it requires careful consideration. The main concern is proving that you did not intend to misuse your tourist visa to immigrate when you initially entered the U.S. The U.S. immigration authorities are wary of visa fraud, so if you marry and then immediately file for a green card, they may scrutinize whether you had pre-planned intentions to immigrate.
It’s often best to wait a few months before applying, to show that the marriage wasn’t planned before your entry. If done correctly, you can adjust your status within the U.S. without leaving, allowing you to remain with your spouse while the green card application is processed.