(covers information from several alternate timelines)
Exists as long as the universe does
The Guardian is a nexus of temporal and transdimensional energies created in the appearance of a great archway. However while in most universes it appears as an arch within some dimensions it appears as an humanoid figure creating the possibility that the "Guardians" are in reality a species that can manipulate their own appearance at will.
Two million years ago, a young Q encountered the Guardian, which resulted in his meeting the malevolent extra-dimensional entity known as 0. One million years ago, 0 used the Guardian to bring other entities like itself into the Universe. At this time was also when the "Guardian of Forever ruins" were created.
The Federation's first contact with the Guardian of Forever was made in 2267 by Captain James T. Kirk of the USS Enterprise. Doctor Leonard McCoy, suffering from cordrazine-induced madness, fled through the Guardian to 1930 Earth. Kirk and Spock followed him and succeeded in preventing him from altering history, but at the cost of the life of Edith Keeler, with whom Kirk had fallen in love. The incident made a profound emotional impact on Kirk. Following its discovery, Federation researchers investigated the possibility of removing the Guardian from its planet to "The Yard", a secret Starfleet facility. This, however, proved not to be a practical option, and all study was conducted on the Guardian's planet. It had become something of an unofficial "Eighth Wonder".
In 2269, Spock assisted a team of historians at Oyya, the original name for the ruins on planet Gateway. During that assignment, Spock found that history had been altered so that he had died as a child. He used the Guardian of Forever to travel to 2237 and save the life of his younger self. Later that year, Spock gained permission to use the Guardian of Forever to visit Sarpeidon's past and bring his son Zar home with him. However, circumstances necessitated Zar returning to his own place in space and time. Shortly after this, when historian William Harrod "accidentally" fell into the Guardian of Forever, Uhura was sent to retrieve him. Towards the end of the year, Kirk and the Enterprise crew used the Guardian of Forever to prevent the Clan Ru from altering Earth's history.
In 2285, Kirk, Spock and McCoy were sent by Starfleet Command to repair the malfunctioning Guardian. It was shortly after this that the Federation set up the Ellison Research Outpost on Gateway to study the Guardian and the timeline.
In 2293, Kirk visited the Ellison Research Outpost, where he questioned the Guardian.
Roughly around 2364, Dr. Elias Frobisher read his own obituary on a playback of the Guardian of Forever.
In 2373, Special Agents Dulmer and Lucsly of the Federation Department of Temporal Investigations used the Guardian of Forever to visit Earth in 2063 and 1996 to follow up on recent temporal incursions by the USS Enterprise and the USS Voyager.
During the Dominion War, around 2374, Roga Danar was recruited by Section 31 to prevent the Dominion from seizing the Guardian. After completing his mission, Roga asked the Guardian what it desired. When it said that it wanted freedom, Roga granted it permission to leave Gateway, which it did.
In 2381, the crew of the the USS Voyager used the Guardian of Forever on planet Gateway to prevent the Suliban from destroying the NX-01 Enterprise in 2153, so the Suliban would not alter pre-Federation history.
In a parallel universe, an humanoid entity known as the "Guardian of the Future" existed as part of an inter-quadrant gateway between the location of the actual "Guardian" in the decaying Omega star system in the Beta Quadrant of the parallel universe and the portal to that planet, located on a moon of Cardassia in the prime universe.
In 2405, Young and K'hallA, who acted as captain of the USS Enterprise-C while her husband suffered under the affliction of the rage virus, were recruited along with Katherine Ann Janeway and Benjamin Sisko by the Guardian to show them a rather dangerous event that would come to pass in the future if something wasn't changed.
- See Conflict Episode "The Prophecy" for a full account of the events listed here.