The one who had left their house, and is on a journey, is a stranger to the land they travel to, alone and away from family and friends. As such, Allah, all praises and glory be to Him, send His infinite mercy upon the traveller and promises to respond to their du’a. This is especially the case for the one who is travelling for the sake of knowledge or with the intention of performing any other act of worship such as the pilgrimages of hajj or umrah.
The traveller has been guaranteed that their du’a will be answered. The Prophet, peace and blessing of ALlah be upon him, said:
“Three are the du’as that are responded to, there is no doubt concerning the: the du’a of he who has been wronged, the traveller, and the du’a of the father for his son.” (Recorded in Abu Dawood)
If this is the case for the one who is travelling for worldly reasons, then it is even more so the case for the one who is travelling for religious reasons, or to visit his parents or a fellow believer in Islam. And Allah knows best.