From one of the immigration related websites
Marriage before Green Card Approval
Whether or not a spouse can be sponsored depends upon the timing of the marriage. This is a very important matter for anyone considering marrying someone from one's home country. It is vital that the marriage occur before the green card case (I-485) is approved. If the primary applicant marries before approval of the I-485, the new spouse will be entitled to derivative immigration benefits. S/He is entitled to the same preference category as the primary beneficiary and the same priority date. This is true even if the marriage occurs well after the establishment of the priority date.
If the derivative spouse is in the U.S., s/he would be able to file for adjustment of status, if otherwise eligible. The most common, and perhaps ideal, scenario is for the marriage to occur while the primary spouse is maintaining nonimmigrant status that permits dual intent, such as the H1B. The H1B spouse would travel to the home country, marry, and return with the spouse, who would hold H-4 status. They would then file I-485s simultaneously. If the primary applicant files the I-485 previously, the derivative would simply file the I-485 shortly after arrival in the U.S. The ability of the derivative spouse to file an I-485 is dependant upon the priority dates being current. There are times when the priority dates "retrogress," or move backwards. If this is the case, the I-485 cannot be filed until the priority date again becomes current.
If the derivative spouse cannot enter the U.S. on a nonimmigrant visa for any one of a number of reasons, it is necessary to consular process for an immigrant visa. This may occur after the primary beneficiary has obtained the approval of the I-485 or both spouses decide to consular process the two cases to obtain permanent residence together. If the principal decides to continue the pending I-485 application, there could be longer waiting periods resulting from the substantial increase in paperwork. Unless the priority dates retrogress, there would not be a priority date waiting time. There is no need for a family-based petition, as the spouse is part of the existing green card case.
Children of lawful permanent residents may be sponsored only as long as they are unmarried and should not marry prior to the green card approval. However, if they marry after the I-130 has been filed, the petition is deemed invalid, and neither the person nor the new spouse would be able to become a green card holder based on that filing. Therefore, unmarried children of lawful permanent residents, who are the beneficiaries of I-130 petitions based on this relationship, should not marry if sponsorship by a lawful permanent resident parent is the only avenue available to them for