Prisons exist on earth for the same reason Hell exists in the spirit world.
Evil behavior must suffer consequences otherwise the concept of Justice would have no meaning.
Those who are wicked and lawless must be restrained and segregated from those who are innocent and peaceful.