Allah the Almighty commands traveling in several verses for various reasons.
1- Learning purposes
“Have they not traveled across the land that their hearts may come to senses and their ears may listen? Indeed it is not the eyes that are blinded; it is rather the hearts in the chests that are rendered blind.” (The Pilgrimage 22:46)
“Say: Travel across the land and see how He created for the first time. Soon, Allah will create another (structure of) rising. Surely, Allah has determined the measure of everything.” (The Spider 29:20)
“We raised a messenger from every community (to tell them): Serve Allah and shun the tyrant. Thereafter Allah accepted some of them in His way and some of them deserved to go astray. Travel across the land and observe the aftermath of those who keep lying to themselves.” (The Bee 16:36)
2- Religious purposes
Allah the Almighty commands about pilgrimage:
“(…) Pilgrimage to that house is a duty owed to Allah by all who can make their way to it. (…)” (Family of Imran 3:97)
3- Migration to better circumstances
“While taking the souls of those who were engaged in wronging themselves, the angels ask: ‘What were you up to?’ They reply: ‘We were too weak and helpless in our land.’ The angels say: ‘Was not the earth of Allah wide enough for you to migrate in it?’ For such men their refuge is Hell, an evil destination indeed.” (The Women 4:97)
Therefore, there is no problem in traveling abroad for any of the reasons above.