The history of the Great Barrier Reef in its present form is widely accepted to have started between 6000 and 8000 years ago, during the final centuries of the last ice age.
The very origins of the Reef, however, date back tens of millions of years ago when Australia drifted northwards from the huge super-continent known as Gondwana.
Gondwana existed many hundreds of millions of years ago, and the break up of the continent into what we now see as Antarctica, South America, Africa, Madagascar, India, Arabia, Australia, New Guinea and New Zealand occurred over many millions of years.

The super continent of Gondwana existed as long as 650 million years ago
Over time, as Gondwana slowly spread apart, Australia finally began to drift northwards - one of the last land masses to separate from Gondwana - about 50 million years ago.
As it drifted, it rotated anti-clockwise and the northern tip (Cape York) began entering the warmer climes of the tropics.
All through these pre-historic times numerous ice ages came and went, each one shaping the north-eastern coast of Australia by carving away at the land and by causing dramatic fluctuations in sea levels.
Theses fluctuations were enough to either leave exposed parts of, or completely submerge, the vast continental shelf that spread away from the mainland for several hundred miles.
When the ice was present, the shelf was hidden beneath it with the massive glaciers carving away ranges of coastal hills and mountains.
And when the ice melted, over many centuries, the sea levels rose to cover the shelf, cutting off the peaks and summits of those hills and mountains from the mainland, to form offshore islands.
As time progressed, each ice age played its part and gradually the very outer mountains were worn down to a fraction of their original size. The final rise in sea level, around 6000 - 8000 years ago, flooded the continental shelf again and the peaks and summits that once were became a new set of islands, with many lower peaks remaining completely submerged.
Shallow lagoons formed close to the mainland coast, providing perfect conditions for new coral growth.

The Great Barrier Reef, as we see it today, started at this time. New coral reefs began building themselves on top of previous reef systems that had appeared every time the sea levels rose after a receding ice age.
These early coral reefs would have begun life during the first days of Australia drifting into the warmer tropical waters, each reef coming and going with the fluctuating sea levels.
The Great Barrier Reef history is indeed a long one, but the development of the Reef is an ongoing cycle.
As global warming now threatens to raise sea levels, new opportunities for coral growth are bound to present themselves over the decades and centuries that lay ahead.
References for information: National Geographic, National Library of Australia
What is the Great Barrier Reef?
The discovery of the Great Barrier Reef