Reference: Fataawa Mu’aasarah – Page 77-78
Response: If she is from among those to whom it is permissible to get married, then there is no harm in that as the Prophet (sal-Allaahu ‘alayhi wa sallam) said:
«A woman is married for four [things]…»…and [therein] he mentioned wealth, and the authenticity [of this narration] is agreed upon [by both al-Bukhaaree and Muslim].
And this situation [as mentioned in the question] is like it (the hadeeth). So if he marries her so he can gain permission to stay [in a country], then there is no harm in that with the condition that he does not have the intention to divorce her once he gains permission to stay. And Allaah [alone] has the Complete knowledge [of all affairs].