"Life is a journey, along different roads, different paths, which leave their mark on us," the pope told inmates at the Curran-Fromhold Correctional Facility Sunday morning.
The 100 inmates in blue uniforms remained in their seats Sunday until two stood up near the end to hug Francis. He also blessed an inmate in a wheelchair.
Francis thanked the inmates at for the large wooden chair that they made for him, calling it beautiful.
PHOTOS: Pope Francis visits Philadelphia prison
He has criticized prison systems that only work to punish and humiliate prisoners, and he has denounced life prison terms and isolation as a form of torture. In his speech Sunday, Francis stressed the importance of rehabilitation.
"This time in your life can only have one purpose: to give you a hand in getting back on the right road, to give you a hand to help you rejoin society," he said. "All of us are part of that effort, all of us are invited to encourage, help and enable your rehabilitation."
Read the full text of Pope Francis' remarks.