During the 5th and 8th centuries BC, and the subsequent Warring States period, the states of Qin, Wei, Zhao, Qi, Han, Yan, and Zhongshan all constructed extensive fortifications to defend their own borders. Built to withstand the attack of small arms such as swords and spears, these walls were made mostly of stone or by stamping earth and gravel between board frames.

King Zheng of Qin conquered the last of his opponents and unified China as the First Emperor of the Qin dynasty ("Qin Shi Huang") in 221 BC. Intending to impose centralized rule and prevent the resurgence of feudal lords, he ordered the destruction of the sections of the walls that divided his empire among the former states. To position the empire against the Xiongnu people from the north.

King Zheng ordered the building of new walls to connect the remaining fortifications along the empire's northern frontier. "Build and move on" was a central guiding principle in constructing the wall, implying that the Chinese were not erecting a permanently fixed border.

Later, the Han, the Northern Dynasties and the Sui all repaired, rebuilt, or expanded sections of the Great Wall at great cost to defend themselves against northern invaders.

Non-Han dynasties also built their border walls: the Xianbei-ruled Northern Wei, the Khitan-ruled Liao, Jurchen Jin and the Tangut-established Western Xia, who ruled vast territories over Northern China throughout centuries, all constructed defensive walls but those were located much to the north of the other Great Walls as we know it, within China's province of Inner Mongolia and in Mongolia itself.

The Great Wall concept was revived again under the Ming in the 14th century, and following the Ming army's defeat by the Oirats in the Battle of Tumu. The Ming had failed to gain a clear upper hand over the Mongolian tribes after successive battles, and the long-drawn conflict was taking a toll on the empire. The Ming adopted a new strategy to keep the nomadic tribes out by constructing walls along the northern border of China. Acknowledging the Mongol control established in the Ordos Desert, the wall followed the desert's southern edge instead of incorporating the bend of the Yellow River.

During the 1440s–1460s, the Ming also built a so-called "Liaodong Wall". Similar in function to the Great Wall (whose extension, in a sense, it was), but more basic in construction, the Liaodong Wall enclosed the agricultural heartland of the Liaodong province, protecting it against potential incursions by Jurched-Mongol Oriyanghan from the northwest and the Jianzhou Jurchens from the north.

Other early accounts in Western sources include those of Gaspar da Cruz, Bento de Goes, Matteo Ricci, and Bishop Juan González de Mendoza, the latter in 1585 describing it as a "superbious and mightie work" of architecture, though he had not seen it. In 1559, in his work "A Treatise of China and the Adjoyning Regions", Gaspar da Cruz offers an early discussion of the Great Wall.

Soon after Europeans reached Ming China by ship in the early 16th century, accounts of the Great Wall started to circulate in Europe, even though no European was to see it for another century. Possibly one of the earliest European descriptions of the wall and of its significance for the defense of the country against the "Tartars" (i.e. Mongols) may be the one contained in João de Barros's 1563 Asia.

Qi Jiguang between 1567 and 1570 also repaired and reinforced the wall, faced sections of the ram-earth wall with bricks and constructed 1,200 watchtowers from Shanhaiguan Pass to Changping to warn of approaching Mongol raiders.

Towards the end of the Ming, the Great Wall helped defend the empire against the Manchu invasions that began around 1600. Even after the loss of all of Liaodong, the Ming army held the heavily fortified Shanhai Pass, preventing the Manchus from conquering the Chinese heartland. The Manchus were finally able to cross the Great Wall in 1644, after Beijing had already fallen to Li Zicheng's rebels.

Under Qing rule, China's borders extended beyond the walls and Mongolia was annexed into the empire, so constructions on the Great Wall were discontinued. On the other hand, the so-called Willow Palisade, following a line similar to that of the Ming Liaodong Wall, was constructed by the Qing rulers in Manchuria. Its purpose, however, was not defense but rather to prevent Han Chinese migration into Manchuria.

When China opened its borders to foreign merchants and visitors after its defeat in the First and Second Opium Wars, the Great Wall became a main attraction for tourists. The travelogues of the later 19th century further enhanced the reputation and the mythology of the Great Wall.

The Great Wall of China was designated by UNESCO in 1987.

In 2009, 180 km of previously unknown sections of the Ming wall concealed by hills, trenches, and rivers were discovered with the help of infrared range finders and GPS devices.

The sections of the Great Wall around Beijing municipality are especially famous: they were frequently renovated and are regularly visited by tourists today. The Badaling Great Wall near Zhangjiakou is the most famous stretch of the Wall, for this is the first section to be opened to the public in the People's Republic of China, as well as the showpiece stretch for foreign dignitaries. The Badaling Great Wall saw nearly 10 million visitors in 2018, and in 2019, a daily limit of 65,000 visitors was instated.