Praise be to Allah.
What is prescribed for the one who is in a city or a place in which sins are committed openly and the sacred limits of Allah are transgressed, is to leave that place and move to another place that will keep him away from such things and is more righteous, and will keep him away from seeing the sacred limits of Allah being transgressed. That is more likely to save him from mixing with sinners and taking part in their sins, and it will help him to avoid approving of sin or compromising with regard to it.
However there is a difference of opinion among the fuqaha’ with regard to this prescription (to move away from that place): is it obligatory or is it merely recommended and encouraged?
Please see: al-Mawsoo‘ah al-Fiqhiyyah (42/190-191)
Al-Bukhaari (3470) and Muslim (2766) narrated from Abu’s-Siddeeq, from Abu Sa‘eed al-Khudri, that the Prophet of Allah (blessings and peace of Allah be upon him) said: “Among those who came before you there was a man who killed ninety-nine people, then he asked who the most knowledgeable man on earth was, and he was directed to a monk. He went to him and told him that he had killed ninety-nine people; could he repent? The monk said no, so he killed him, thus completing one hundred. Then he asked who the most knowledgeable man on earth was, and he was directed to a man of knowledge and said that he had killed one hundred people; could he repent? He said: Yes, who could stand between him and repentance? Go to such and such a land, for therein there are people who worship Allah, so go and worship Allah with them, and do not go back to your own land for it is a bad land. So he set out, then when he was halfway there, death came upon him. The angels of mercy and the angels of torment disputed over him. The angels of mercy said: he came repenting and turning wholeheartedly towards Allah. The angels of torment said: He never did anything good. Then an angel in the form of a man came to them and they appointed him (to decide) between them. He said: Measure the distance between the two lands, and whichever is closer, that is where he belongs. So they measured it and they found that he was closer to the land that he was heading for, so the angels of mercy took him.
Al-Haafiz Ibn Hajar (may Allah have mercy on him) said:
This indicates that there is virtue in moving from a land in which a person may commit sin because staying there could hinder his repentance, either because he is reminded of the deeds that he did before that and he may be tempted to do them again, or because there are people there who would urge him to commit such deeds. Hence the second man (the man of knowledge) said to him: “do not go back to your own land for it is a bad land.” This indicates that the one who repents should leave the circumstances that he was used to at the time of sin, and move away from that place.
End quote from Fath al-Baari by Ibn Hajar (6/517)
The point here is that the land in which sins are committed is a place where its inhabitants may encourage him to commit similar sins to those that are committed openly, or at the very least revulsion at such sins is stripped from their hearts and the resolve to denounce them is weakened or is absent altogether, because they have gotten used to seeing them. This is something that is well known and is often seen.
Hence what is prescribed in the case of your brother is to stop residing in that city in which sins are committed openly and there are a lot of prostitutes, so as to protect his religious commitment and to protect himself from temptation, for sins may overwhelm one’s heart and mind, and no one knows from where temptation will come to him.
With regard to saying that his work is there, it may be said that this is not an excuse for him; rather if he is able to find work in another place that is better for him than that, without it causing further harm to him, then he has no right to remain in that place. If he is not able to do that, it should be noted that there are so many people who work in one place and live elsewhere, for one reason or another, so why does he have to carry on living there?
What the individual must do is be keen to preserve his religious commitment above all else, and to protect it above all else.
For more information, please see the answer to question no. 170287
And Allah knows best.