(covers information from several alternate timelines)
Warp core, or warp core reactor, was the common designation for the main energy reactor powering the propulsion system on warp-capable starships. During the 22nd century, warp reactors aboard NX-class starships were technically known as the "gravimetric field displacement manifold". (ENT: "Cold Front") The reactor had eight major components. (ENT: "Desert Crossing") A less common name for this core was antimatter reactor core. (TNG: "Booby Trap", display graphic)
The first Terran warp core was invented by Zefram Cochrane in 2061 and used in Humanity's first warp-capable vessel, the Phoenix, in 2063. This in turn led to the event known as First Contact Day, on which the Human species met the Vulcans. (Star Trek: First Contact; VOY: "Friendship One", "Homestead")
On Federation starships, the warp core usually consisted of a matter/antimatter reaction assembly (M/ARA) utilizing deuterium and antideuterium reacting in a dilithium crystal matrix, producing a maximum output of four thousand teradynes per second. (VOY: "Drone")
22nd century warp cores were designed as oblong cylinders connected by pylon conduits directly into the warp nacelles. (Star Trek: Enterprise)
For the majority of the 23rd century, the warp core was mostly horizontal and not completely situated in main engineering (TOS: "That Which Survives"). In Constitution-class starships the antimatter intermix chamber and dilithium energizer and converter were in separate locations. Before 2267 aboard the starship Enterprise, the dilithium crystal reaction occurred in what was called the energizer in a location labeled Engineering but in a room separate from Main Engineering (TOS: "The Alternative Factor"). In this room the crystal energizer consisted of multiple wall bins which opened out for crystal access and energizer maintenance. The resulting warp plasma reaction was directed from here (by unseen conduits) into the main plasma conduits to the warp engines, which were behind a large metal grate in Main Engineering. Top emergency speed at this time was warp factor 8.
By 2267, the warp core of the starship Enterprise had been modified with a dilithium crystal converter assembly in Main Engineering. This consisted of two flattened rounded nodules with the crystal assembly in the middle which could be raised and lowered for crystal access and the assembly maintenance. (TOS: "Elaan of Troyius", "The Paradise Syndrome") The converter assembly focused the matter/antimatter reaction plasma from the intermix chamber. It was directed by an unseen conduit to the converter assembly for conversion to a super energized warp plasma to attain higher warp velocities . The resulting electro-plasma from the crystal converter reaction was then directed by unseen conduits into the warp plasma conduits to the warp engines at the back of Main Engineering. (Star Trek: The Original Series; ENT: "In a Mirror, Darkly, Part II") This upgrade allowed for top emergency speeds of warp factor 9.
In 2269, warp cores began a radical change. While still being mostly horizontal, a vertical segment was added to the dilithium crystal converter in Main Engineering, marking the transition to a new age of Starfleet warp core design. (Star Trek: The Animated Series)
By 2270, most Federation warp cores were redesigned to consist of a large warp core unit. Located in the secondary hull, the matter and antimatter reaction plasma from the intermix chamber traveled the core through vertical conduits into the dilithium crystal converter, or main energizer as it was then called (Star Trek II: The Wrath of Khan), with the resulting warp pasma energy directed to the nacelles through horizontal conduits leading out from the rear of the core. (Star Trek: The Motion Picture) This advancement allowed for speeds of up to warp factor 12 on the old scale. At this point the warp speed scale was revised for TNG to allow for higher warp speeds.
As a safety precaution, the core could usually be physically ejected from the ship, should an event such as a catastrophic containment failure of the matter-antimatter reaction occur that could not be corrected. There were also some tactical uses for ejecting and detonating a core on purpose. The detonation could, for example, be used to neutralize the cascade of a subspace tear or to push a ship away from the gravity well of a black hole. (TOS: "That Which Survives"; TNG: "Cause and Effect", "All Good Things..."; VOY: "Cathexis", "Day of Honor", "Renaissance Man"; Star Trek: Insurrection; Star Trek)
Antimatter containment was achieved through the use of magnetic fields, which guided and directed the antimatter through the antimatter integrator to injector coils, which precisely compressed and streamed the antimatter into the form which entered the intermix chamber. Deuterium, stored in the ship or attracted by the Bussard collectors, was funneled in a stream from the opposite deuterium injector. The resulting energy plasma molecules entered the lattice matrix of the crystallized dilithium chamber, reacting within it and releasing a tuned energy stream in the form of electro-plasma, a highly energetic form of plasma. The electro-plasma was carried by magnetic plasma conduits throughout the power transfer system. In the Federation power transfer grid, this was the electro-plasma distribution network, comprised of EPS conduits and EPS taps. The most energized stream created was the warp plasma, which exited in twin power transfer conduits connected to the warp nacelles. (ENT: "Cold Front", "These Are the Voyages..."; Star Trek: Insurrection)
By the 24th century the dilithium crystal converter and matrix was replaced by a dilithium chamber matrix and articulation frame housed directly inside the matter-antimatter intermix chamber in a vertical warp core. (TNG: "The Best of Both Worlds", "Relics")
Dilithium crystals were also used in Klingon warp reactions on the 23rd century to generate energy at sufficient levels to enable warp flight. In the late 24th century, Klingon reactors used a tritium intermix, a feature not included in Federation and Romulan ships of the same era. (DS9: "When It Rains...") On Romulan starships, a completely different approach was used; an artificial quantum singularity in the warp core harnessed the energy necessary to power warp flight. (TNG: "Timescape")
When a warp core went offline, deuterium was a vital fuel to support basic functions of a ship's auxiliary fusion reactors and impulse drive. Warp cores from shuttlecraft and shuttlepods could augment power, if necessary. (VOY: "The Void")