Assuming you are speaking of marrying a U.S. Citizen, your status doesn't change automatically but you can apply to adjust your status. I suggest consulting an immigration attorney in relation to the application for adjustment of status. Don't leave the country before you get married, as you will probably both be unable to return and subject to a multi-year period of exclusion from the U.S.