There is historical basis for similar warning beacons that Tolkien would have been aware of
Tolkien has never spoken about his inspiration for the beacons of Gondor, but warning beacons have frequently been used in both history and literature that Tolkien was familiar with.
Tolkien scholars Wayne Hammond and Christina Scull in particular point to the alarm beacons that warned London of the Spanish Armada.
747 (III: 19). The beacons of Gondor are alight, calling for aid. - On reading this, almost every English man, woman, and child would immediately think of the beacons lit in 1588 to warn of the approach of the Spanish Armada. Tolkien almost certainly knew Thomas Babington Macaulay’s poem The Armada, which recounts the event:
Till Belvoir’s lordly terraces the sign to Lincoln sent,
And Lincoln sped the message on o’er the wide vale of Trent;
Till Skiddaw saw the fire that burned on Gaunt’s embattled pile,
And the red glare on Skiddaw roused the burghers of Carlisle.
The Lord of the Rings: A Reader's Companion - Book 5 Chapter 1
Lord Macaulay’s poem is from Lays of Ancient Rome, a book Tolkien is known to have read. (Tolkien parodies the style in his 1911 poem The Battle of the Eastern Field, and characters from the book are referenced in 1914 correspondence between Tolkien and Christopher Wiseman.)
Additionally, one of the surviving beacons was located in Lickey Hills, an area Tolkien spent some time in growing up.
Tolkien knew the country well, for it was close to Rednal, where his mother had spent the last months of her life, and to Barnt Green where his maternal cousins, the Incledons, lived. He had good times at their house, and stayed there often.
JRR Tolkien: Artist & Illustrator - "Early Work"
In 1913, Tolkien painted a landscape watercolor of the view from on top of Bilberry Hill, a hill that was adjacent to the one with the beacon.

King's Norton from Bilberry Hill
JRR Tolkien: Artist & Illustrator - figure 16
Hammond and Scull also note other places Beacons have been used, such as the Byzantine beacon system that warned Constantinople of a Saracen invasion, and the beacons mentioned in the Iliad.
Beacons have long been used to signal warnings and to call for aid. In the eighth and ninth centuries, for instance, the news of a Saracen invasion on the Cilician frontier was flashed to Constantinople by eight beacon fires. Even earlier, Homer wrote in the Iliad: ‘Thus, from some far-away beleaguered island, where all day long the men have fought a desperate battle from their city walls, the smoke goes up to heaven; but no sooner has the sun gone down than the light from the line of beacons blazes up and shoots into the sky to warn the neighbouring islanders and bring them to the rescue in their ships’
The Lord of the Rings: A Reader's Companion - Book 5 Chapter 1
And as also can be demonstrated by the other answers and comments on this question, there are many additional places Tolkien would have been aware of that he could have drawn the beacons from. It may be difficult to prove that any one specific example is what Tolkien was basing his beacons on, more so than just a general amalgamation of the concept that would have been familiar to him.