I realized that nowhere (as far as I can tell) is there a reference to prison being a punishment in the Torah. The closest I even come to someone being kept in prison is the man found gathering sticks on Shabbos, who was "put under guard" until they figured out what to do to him. (Bamidbar 15:34)

Does the concept of prison exist in the Jewish legal system?