He was narrowly saved on two occasions from what seemed like certain death – once after instinctively uttering a prayer to the Virgin Mary after falling wounded in enemy territory; and again, when he was falsely suspected of theft and nearly executed but for another soldier's intervention.
Events such as these weighed heavily upon him, and when his regiment was disbanded he decided to amend his life – beginning with a pilgrimage to Spain's Santiago de Compostela Cathedral along the “Way of St. James.” There, he confessed his sins and committed himself to living a life of repentance.
Soon after this, he returned to Portugal and discovered what had become of his parents. His mother had died, brokenhearted, after the loss of her son, after which his father had become a Franciscan monk.
At age 42, John returned to Spain and picked up nearly where he had left off 20 years before, working again as a shepherd. This time, however, he was committed to living out the faith in God that he had regained.
He traveled briefly to North Africa, seeking to help Christians there who had been enslaved by Muslims. Eventually, however, he returned to Spain and settled for a time in the occupation of selling religious books and other goods, always encouraging his customers to live their faith sincerely. St. John of God's later reputation as the patron saint of booksellers derives from this period of his life.
Later, however, he felt compelled to give himself entirely to the service of the poor, sick, and vulnerable. He opened his house to them – allowing it to become a combined hospital, homeless shelter, and halfway-house, run entirely by John himself. When he was not bandaging wounded occupants or breaking up fights between them, he would go out begging on their behalf.
The Bishop of Granada approved his work, and gave him the name “John of God.” A group of volunteers came to accompany him in his work, many of whom had first come to him while in dire need themselves.
Others, who resented his work, assaulted John's reputation by focusing on his past sins – but John, unfazed in his humility, would acknowledge the truth of what was said, as a testament to God's grace in his life. He once offered to pay a woman to tell the entire city what she had been saying about him in private.
John served the sick and poor for 15 years before meeting his death through an act of charity. He jumped into a freezing river and managed to save a drowning man, but came home shivering and weakened from the ordeal. He lay down in one of his own hospital beds, where his condition further declined.
The Bishop of Granada came to administer the last rites. As the bishop prepared him for death, John expressed a number of anxieties.