It has been argued that the earliest inscriptions in ogham date to about the 4th century AD, but James Carney believed its origin is rather within the 1st century BC. Although the use of "classical" ogham in stone inscriptions seems to have flowered in the 5th and 6th centuries around the Irish Sea, from the phonological evidence it is clear that the alphabet predates the 5th century. A period of writing on wood or other perishable material prior to the preserved monumental inscriptions needs to be assumed, sufficient for the loss of the phonemes represented by úath ("H") and straif ("Z" in the manuscript tradition, but probably "F" from "SW"), gétal (representing the velar nasal "NG" in the manuscript tradition, but etymologically probably "GW"), all of which are clearly part of the system, but unattested in inscriptions.
It appears that the ogham alphabet arose from another script, and some even consider it a mere cipher of its template script (Düwel 1968: points out similarity with ciphers of Germanic runes). The largest number of scholars favours the Latin alphabet as this template, although the Elder Futhark and even the Greek alphabet have their supporters. Runic origin would elegantly explain the presence of "H" and "Z" letters unused in Irish, as well as the presence of vocalic and consonantal variants "U" vs. "W", unknown to Latin writing and lost in Greek (cf. digamma). The Latin alphabet is the primary contender mainly because its influence at the required period (4th century) is most easily established, being widely used in neighbouring Roman Britannia, while the runes in the 4th century were not very widespread even in continental Europe.
In Ireland and in Wales, the language of the monumental stone inscriptions is termed Primitive Irish. The transition to Old Irish, the language of the earliest sources in the Latin alphabet, takes place in about the 6th century. Since ogham inscriptions consist almost exclusively of personal names and marks possibly indicating land ownership, linguistic information that may be glimpsed from the Primitive Irish period is mostly restricted to phonological developments.
Theories of origin
There are two main schools of thought among scholars as to the motivation for the creation of ogham. Scholars such as Carney and MacNeill have suggested that ogham was first created as a cryptic alphabet, designed by the Irish so as not to be understood by those with a knowledge of the Latin alphabet. In this school of thought, it is asserted that the alphabet was created by Irish scholars or druids for political, military or religious reasons to provide a secret means of communication in opposition to the authorities of Roman Britain. The Roman Empire, which then ruled over neighbouring southern Britain, represented a very real threat of invasion to Ireland, which may have acted as a spur to the creation of the alphabet. Alternatively, in later centuries when the threat of invasion had receded and the Irish were themselves invading the western parts of Britain, the desire to keep communications secret from Romans or Romanised Britons would still have provided an incentive. With bilingual ogham and Latin inscriptions in Wales, however, one would suppose that the ogham could easily be decoded by anyone in the Post-Roman world.
The second main school of thought, put forward by scholars such as McManus, is that ogham was invented by the first Christian communities in early Ireland, out of a desire to have a unique alphabet for writing short messages and inscriptions in the Irish language. The argument is that the sounds of Primitive Irish were regarded as difficult to transcribe into the Latin alphabet, so the invention of a separate alphabet was deemed appropriate. A possible such origin, as suggested by McManus (1991:41), is the early Christian community known to have existed in Ireland from around AD 400 at the latest, the existence of which is attested by the mission of Palladius by Pope Celestine I in AD 431.
A variation is that the alphabet was first invented, for whatever reason, in 4th-century Irish settlements in west Wales after contact and intermarriage with Romanised Britons with a knowledge of the Latin alphabet. In fact, several ogham stones in Wales are bilingual, containing both Irish and British Latin, testifying to the international contacts that led to the existence of some of these stones.
A third theory put forward by the noted ogham scholar R. A. S. Macalister was influential at one time, but finds little favour with scholars today. Macalister believed that ogham was first invented in Cisalpine Gaul around 600 BC by Gaulish druids as a secret system of hand signals, and was inspired by a form of the Greek alphabet current in Northern Italy at the time. According to this theory, the alphabet was transmitted in oral form or on wood only, until it was finally put into a written form on stone inscriptions in early Christian Ireland. Later scholars are largely united in rejecting this theory, however, primarily because a detailed study of the letters shows that they were created specifically for the Primitive Irish of the early centuries AD. The supposed links with the form of the Greek alphabet that Macalister proposed can also be disproved.
Macalister's theory of hand or finger signals as a source for ogham is a reflection of the fact that the signary consists of four groups of five letters, with a sequence of strokes from one to five. A theory popular among modern scholars is that the forms of the letters derive from the various numerical tally-mark systems in existence at the time. This theory was first suggested by the scholars Rudolf Thurneysen and Joseph Vendryes, who proposed that the ogham script was inspired by a pre-existing system of counting based around the numbers five and twenty, which was then adapted to an alphabet form by the first ogamists.
According to the 11th-century Lebor Gabála Érenn, the 14th-century Auraicept na n-Éces, and other Medieval Irish folklore, ogham was first invented soon after the fall of the Tower of Babel, along with the Gaelic language, by the legendary Scythian king, Fenius Farsa. According to the Auraicept, Fenius journeyed from Scythia together with Goídel mac Ethéoir, Íar mac Nema and a retinue of 72 scholars. They came to the plain of Shinar to study the confused languages at Nimrod's tower (the Tower of Babel). Finding that they had already been dispersed, Fenius sent his scholars to study them, staying at the tower, co-ordinating the effort. After ten years, the investigations were complete, and Fenius created in Bérla tóbaide "the selected language", taking the best of each of the confused tongues, which he called Goídelc, Goidelic, after Goídel mac Ethéoir. He also created extensions of Goídelc, called Bérla Féne, after himself, Íarmberla, after Íar mac Nema, and others, and the Beithe-luis-nuin (the ogham) as a perfected writing system for his languages. The names he gave to the letters were those of his 25 best scholars.
Alternatively, the Ogam Tract credits Ogma mac Elathan (Ogmios) with the script's invention. Ogma was skilled in speech and poetry, and created the system for the learned, to the exclusion of rustics and fools. The first message written in ogam were seven b's on a birch, sent as a warning to Lug mac Elathan, meaning: "your wife will be carried away seven times to the otherworld unless the birch protects her". For this reason, the letter b is said to be named after the birch, and In Lebor Ogaim goes on to tell the tradition that all letters were named after trees, a claim also referred to by the Auraicept as an alternative to the naming after Fenius' disciples.