The brig on a starship was a room full of holding cells where prisoners could be detained. On Starfleet starships, each holding cell had a force field to contain the prisoner within his cell. In other facilities, the brig might be called a prison.
Sometime in the 2360s, Antonio Fernandes, in temporary command of the USS Wellington, ordered Ro Laren thrown in the brig for disobeying a direct order leading to the death of eight Wellington officers, including the commanding officer, first officer, and second officer. Ro was to remain there until the ship returned to a safe haven. (Star Trek: The Cantabrian Expeditions: "Catalyst, Part One", "An Innocent Time", "Salvation")
In 2367, the real Dr. Justin O'Donovan, the real Jennifer Drever, and the clone Daniel Radke were thrown in the faux USS Prospect's brig. The clone Anne Lansing and several mutineers freed them and escaped aboard shuttlecraft as faux Prospect was being attacked by a Directorate battle cruiser. (Star Trek: The Prospect Chronicles: "Live to Tell")
In mid-2373, the USS Cantabrian's acting commanding officer Elizabeth Singh threw several brawling visitors into one of the Cantabrian's brigs. She threatened to leave them there for the entire journey to Starbase Expanse 7 if they didn't agree to start behaving. (Star Trek: The Cantabrian Expeditions: "Isolation")