Antimatter containment was the process whereby antimatter and matter were kept separated by the use of magnetic fields to prevent the oppositely charged particles from colliding, which would result in the mutual destruction of the matter and antimatter, along with a violent and explosive release of pure energy according to Einstein's formula E=mc2.
Antimatter containment was a key function of a starship warp core which used both antimatter and matter, released in controlled and balanced amounts, to provide energy which powers the ship's warp drive.
Galaxy-class starships in the 24th century had a system of seven independent computer safety locks to prevent antimatter containment from being breached, assuming that there was no damage to the warp core components. (TNG: "Contagion")
In 2366 the non-corporeal Koinonians drained antimatter from the antimatter pods to use it as energy to create their replica of Marla Aster. This was stopped by increasing the shield harmonics to match the antimatter containment, effectively severing the Koinonian beam. (TNG: "The Bonding")
After Wesley Crusher experimented with a static warp bubble in main engineering in early 2367 and a flash of light was registered, Geordi La Forge ran a level-2 diagnostic of the antimatter containment and warp drive to make sure that none of the systems were affected by the experiment. (TNG: "Remember Me")
In circa 3069, much of the Milky Way Galaxy's dilithium suddenly went inert in an event known as the Burn, which resulted in any starship with an active warp core losing antimatter containment and exploding. Millions of people were killed in this event. (DIS: "That Hope Is You, Part 1", "People of Earth")