Jail

A jail is a room used by the justice system. They are designated from a constructed restraint or metal cage by setting them to be used for justice.

As your dwarves break the law, your Sheriff/Captain of the Guard, or any Fortress Guard, will place them in one of the designated restraints. However, should they be unable to (no jail, jail is full, or if the crime is terrible enough), the Hammerer (if you have one) will come to give them a severe hammer beating.