All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger. We ask Allaah to exalt his mention as well as that of his family and all his companions.
If the law on taking unemployment benefits allows those who live outside the country to benefit from it then it is permissible to take this allowance. However, if it is a condition to reside in the country in order to be eligible for this benefit then it is not permissible for you to take it unless you reside in that country. Indeed the Prophet said: "The Muslims should fulfil their conditions within what is permissible." [Al-Bukhari and Abu Daawood]
Therefore, what matters are the conditions that are set by the government in order to be eligible for this kind of benefit and it is not permissible to violate these conditions.
Imaam Al-Maawardi said: 'Indeed the jurists agreed in a consensus that if a Muslim enters a country of war in peace and safety, it is forbidden for him to violate their blood, wealth or honour [commit adultery] as Muslims should fulfil their conditions within what is permissible.' [Al-Bukhari and Abu Daawood]
Allaah Knows best.