(covers information from several alternate timelines)
A breach could occur in a variety of ways, but was frequently characterized by a coolant leak from the main reaction chamber, resulting in a runaway reaction within the warp core. Antimatter containment was lost, and the resultant contact between antimatter and the normal matter of the ship destroyed the vessel.
Consequences and prevention
The breach was almost always irreversible, as most safety protocols and systems would have failed prior to the event. Warp core ejection was a common method of dealing with a breach, although this was considered a last ditch effort and often failed aboard. The evacuation of the crew to the primary hull and initiating separation was also used in cases where the vessel had that capability, such as on Galaxy-class vessels. In situations where a saucer separation could not be initiated, then evacuation of the ship via escape pods or shuttles would occur. Regardless, the aim was to get as much distance between the core and the crew as possible before detonation. In the case of saucer separation (or warp core ejection), the ship was left running on impulse power and batteries, as the warp core and warp nacelles were required for warp drive.
In 2267, Khan Noonien Singh tried to blow up the starship USS Enterprise by overloading the warp core when he failed to capture it. James T. Kirk stopped him and the overload in time. (TOS: "Space Seed")
In 2365, the USS Yamato had been scanned by the Iconian probe orbiting the planet of Iconia in the Romulan Neutral Zone. After the Yamato rendezvous with her sister ship the USS Enterprise-D, the energy build up in the engineering section by the Iconian scan overloaded the warp core. (TNG: "Contagion")
In 2368, the Enterprise-D collided with the USS Bozeman after encountering a space-time distortion in the Typhon Expanse, causing a warp core breach which destroyed the ship. The explosion led to the creation of a temporal causality loop, from which the Enterprise was able to avoid the collision before it happened. (TNG: "Cause and Effect")
In 2369, the Enterprise-D was destroyed by a warp core breach, generated by a massive energy feedback into the warp core from a power transfer to a Romulan vessel. The core breach was averted when time reset itself and Captain Picard remotely steered a runabout into the transfer beam. (TNG: "Timescape")
In 2371, the engineering hull of the Enterprise-D was destroyed in a warp core breach caused by a coolant leak following rupture of the magnetic interlocks due to an attack by a D12-class Bird-of-Prey. The ion shock wave created by the explosion of the vessel's stardrive section caused the vessel's saucer section to be disabled and crash-land on Veridian III. All hands survived, but the vessel was a total loss. (Star Trek Generations)
In early 2372, as a result of a subspace inversion of the Bajoran wormhole, the USS Defiant was under threat of a core breach, with the ejection system disabled. Benjamin Sisko was able to shunt the excess power over to the deflector array with the help of an interphasic compensator, averting the breach. (DS9: "The Visitor")
In 2374 during a test of the Borg transwarp drive aboard the USS Voyager, tachyons got into the warp core and almost caused a warp core breach. B'Elanna Torres was able to eject the warp core and evacuate engineering. (VOY: "Day of Honor")
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")
Nucleonic particles from a polaric field flooded the intake manifolds of Enterprise NX-01 in 2153, causing an injector flare that could have caused a warp core breach. Trip Tucker sustained life-threatening injuries during a manual shutdown of the reactor to prevent the breach. (ENT: "Similitude")
Antineutrinos tended to have a neutralizing effect on warp core containment fields of Federation starships. A Sikarian spatial trajector field, utilizing antineutrinos, nearly caused a warp core breach on the USS Voyager. (VOY: "Prime Factors") One of the USS Voyager's shuttlecraft, the Cochrane, was destroyed by a warp core breach in 2374. Its occupants, B'Elanna Torres and Tom Paris, had to don environmental suits and beam into open space to await rescue. (VOY: "Day of Honor")
The reaction of veridium isotopes with warp plasma would cause a warp core breach. This led to the near destruction of the Delta Flyer in 2377, although the warp core was successfully ejected into a class J nebula before the explosion could destroy the vessel. (VOY: "Drive")
If a large number of tachyons leaked into a warp core, a warp core breach was almost certain to occur, as a result of the tachyons creating a resonance frequency causing the core pressure to increase out of control. (VOY: "Day of Honor")
Warp core breaches were occasionally performed deliberately; they were most often used as the primary means of fulfilling a starship's auto-destruct sequence.
Q purposefully caused the core aboard the Enterprise-D to breach in 2369 (so that, if he was right and she was in fact a Q, Amanda Rogers could prevent it), and Geordi La Forge caused a breach of the USS Enterprise-E's warp core in 2375 to seal a subspace tear caused by an isolytic burst (the core having been ejected from the ship prior to detonation).(TNG: "True Q"; Star Trek: Insurrection)
In 2258 of Nero's alternate reality, Montgomery Scott ejected and detonated the warp cores of that timeline's USS Enterprise and the resultant explosion pushed the ship free of the black hole consuming the Narada. (Star Trek)
To demonstrate the damaging effects warp drive were having on subspace, Serova took her ship out into the Hekaras Corridor and intentionally overloaded her warp engines, causing a core breach that killed her and destroyed her ship. The resultant burst of warp energy proved her theory by creating a subspace rift. (TNG: "Force of Nature")