das Gefängnis
prison
A building or institution in which people who have committed a crime are locked up.
Der Verurteilte wurde in das örtliche Gefängnis gebracht.
The convicted man was taken to the local prison.

prison
Loading your saved state.
prison
A building or institution in which people who have committed a crime are locked up.
Der Verurteilte wurde in das örtliche Gefängnis gebracht.
The convicted man was taken to the local prison.

The word derives from the verb 'fangen' (to catch). The prefix 'Ge-' and the ending '-nis' often form nouns that describe a state or place. A 'Gefängnis' (prison) is therefore a place where one is 'gefangen' (captured/imprisoned).
Die Polizei konnte den Dieb schnell fangen.
The police were able to catch the thief quickly.
Pay attention to the case with the preposition 'in': movement toward a place requires the accusative ('ins Gefängnis kommen' — to go to prison), while being in a place requires the dative ('im Gefängnis sein' — to be in prison).
Er musste für zwei Jahre ins Gefängnis.
He had to go to prison for two years.
When 'Gefängnis' (prison) describes the type of punishment, it is often used without an article and together with a time expression. Typical verbs here are 'bekommen' (to get/receive) or 'verurteilt werden zu' (to be sentenced to).
Der Angeklagte bekam eine Strafe von fünf Jahren Gefängnis.
The defendant got a sentence of five years in prison.
The meaning 'Gebäude' (building) is intended when it is about a concrete place (e.g. 'das Gefängnis besuchen' — to visit the prison). The meaning 'Strafe' (punishment) is intended when it is about a sentence or a duration (e.g. 'drei Jahre Gefängnis' — three years in prison).
Das alte Gefängnis in der Stadt ist heute ein Museum.
The old prison in the city is now a museum.
construction / building
'der Bau' and 'das Gefängnis' can mean the same thing in colloquial use. 'das Gefängnis' is the normal, neutral word for the place, or also the punishment, in which someone is locked up. 'der Bau' is slangy for this and sounds clearly colloquial. Learners may confuse the words because 'Bau' otherwise also means a building or a construction process. In official or serious situations, it is better to use 'Gefängnis'. 'Bau' is more suitable in casual conversations or colloquial language.

Das Gefängnis liegt außerhalb der Stadt und wird streng bewacht.
The prison is outside the city and is strictly guarded.
Nach dem Einbruch kam er für zwei Jahre in den Bau.
After the break-in, he went to jail for two years.