Confining a person, removing one's freedom to come and go at will.
Imprisoning removes unwanted persons from society, protecting both from encounters deemed injurious or unhelpful.
Imprisoning postpones (even indefinitely) the encounters between an individual and society, but does nothing directly to change the quality of the encounters. It is a postponement of an issue, not a solution.
Most prisons inculcate crime, rather than rehabilitate criminals.