My question is:
What is the ruling on this money that the lawyer got for getting them out?.
The ruling on practising law has been explained in a fatwa quoted in the answer to question no. 9496. We stated there that it is haraam for lawyers to protect evil and defend those who do evil, and that this comes under the heading of cooperating in sin and transgression, which Allaah has forbidden as He says (interpretation of the meaning):
“Help you one another in Al‑Birr and At‑Taqwa (virtue, righteousness and piety); but do not help one another in sin and transgression. And fear Allaah. Verily, Allaah is Severe in punishment”
Based on this, the lawyer who defended these evil dealers who spread mischief in the land by selling haraam drugs has to repent to Allaah, may He be exalted, from this action. He should hasten to advise those evildoers not to follow a path that will let them escape from the punishment they deserve. He has to go back before the judges and retract his defence, if it is not too late, and he should not agree to carry on with them if there is any appeal against them.
With regard to the money that he has taken from them, it is haraam wealth, because he took it in return for a haraam deed. Hence as well as repenting, seeking forgiveness and resolving not to do this again, he has to hasten to get rid of this wealth, by spending it on charitable causes. He should remember that the Prophet (peace and blessings of Allaah be upon him) said: “The one who repents from sin is like the one who did not sin at all.” He should also note that by doing that he will purify his permissible wealth, because if he keeps the haraam wealth, that may lead to the destruction of the permissible wealth that he has. It is not permissible for him to give it back to those dealers. We ask Allaah to compensate him with something better than it.
And Allaah knows best.