A somewhat formal or literary term for a prison or jail. In everyday speech, 刑務所 (けいむしょ) or 拘置所 (こうちしょ) are more common.
He was confined in prison.
Compound of 獄 (ごく, 'prison') and 屋 (や, 'house, building'). The exact historical derivation is uncertain, but the kanji combination directly suggests a building used as a prison.