Remember that medieval university students had immunity from the town's jurisdiction, rooted in the clerical immunity. Many students, originally, were in minor orders, though not intending to become priests. Clerics were supposed to be tried by church courts,so student immunity from town laws was rooted in that immunity.
So the universities were responsible for policing the conduct of students and needed the means thereto. The townspeople often concluded that students got away with murder, shall we say and this led, on occasion to town and gown riots. Remember that until relatively recently in urban settings, men NEVER went out unarmed--one always carried a sword, because one might truly have to defend oneself.
The postcard appears to show a display of student Burschenschaften (student clubs, dueling clubs, something like fraternities, rooted in the early 1800s Romantic nationalism after the end of the Napoleonic wars) hats. Heidelberg was a relatively late university foundation (late 1300s; the universities of Paris, Oxford, Bologna date to the early 1200s with roots before that in bishops' schools going back to the 1000s.) But Heidelberg became the epitome of a German Romantic university town because of the castle ruins (destroyed in Louis XIV's wars). Actually, Marburg and Tuebingen are much better illustrations of university towns than is Heidelberg. At Marburg the Burschenschaften still existed when I was a student there in the early 1970s.
Karzer is simply a transliteration of carcer (prison), derived from the same Latin word that gives us incarceration. The normal German word for prison was traditionally Kerker, which is just another variant on the same word, but not strictly a transliteration. But today Kerker sounds too harsh so people speak anodynely of a Strafanstalt (a punishment institution).