The earliest known inhabitants of the area now known as Bosnia and Herzegovina were the Illyrians , who spoke a language related to modern Albanian. The Romans conquered Illyria after a series of wars, and Latin -speaking settlers from all over the empire settled among the Illyrians. The Roman province of Dalmatia included Herzegovina and most of Bosnia, and a strip of northern Bosnia, south of the Sava River, was part of the province of Pannonia . Modern Albanians trace their ancestry to the ancient Illyrians, and the Vlachs , a historically nomadic people who live throughout the Balkans, speak a language derived from Latin, and are thought to be the descendants of Roman settlers and Romanized Illyrians.

The Germanic Goths conquered Roman Dalmatia in the fifth century, and later the Alans , who spoke an Iranian language, and the Turkic Huns and Avars passed through what is now Bosnia. These invaders left few linguistic traces, and whatever remnant populations were left behind were absorbed by the Slavic wave that was to follow.

Slavs settled in Bosnia, Herzegovina, and the surrounding lands, which were then part of the Eastern Roman Empire, in the seventh century. The Slavic Serbs and Croats settled sometime after the first wave of Slavs. The Croats established a kingdom in what is now central Croatia and northwestern Bosnia. The Serbs settled in what is now central Serbia, and later expanding into the upper Drina valley of eastern Bosnia and into Herzegovina, known in the later Middle Ages as Hum. The Croats to the west came under the influence of the Germanic Carolingian Empire and the Roman Catholic Church, and Croatia was closely tied to Hungary and later Austria until the twentieth century. The Serbs to the east came under periodic Byzantine rule, converted to Eastern Orthodox Christanity and absorbed Byzantine cultural influences. After some centuries of rule by Croatia, Serb principalities, and the Byzantine Empire, an independent Bosnian kingdom flourished in central Bosnia between the twelfth and the fifteenth centuries. The Bosnian Kingdom blended cultural influences from east and west; although nominally Roman Catholic, the Bosnian kings embraced elements of Byzantine culture and court ceremonial, and formed alliances and dynastic marriages with the neighboring rulers of both Croatian-Dalmatian and Serb states. At its largest extent, under King Tvrtko Kotromanic , the Bosnian Kingdom included most of present-day Bosnia and Herzegovina, with the exception of north-western Bosnia, as well as parts of Dalmatia and western Serbia . Discord among his heirs weakened the kingdom after his death, and Bosnia and the Serb principalities to the east were unable to prevent Ottoman Turkish incursions into the western Balkans. The final Turkish conquest in 1463 marked the end of an independent Bosnia and the beginning of the influence of a third civilization, Islam.

Historians have debated how and why the Slav population in Bosnia converted in such large numbers to Islam. The religious situation in Bosnia before the Turkish conquest was complex and unclear. Prior to 1463, Eastern Orthodoxy was probably limited to the upper Drina River valley and to Herzegovina (Hum), which was predominantly Orthodox. The rest of Bosnia was nominally Roman Catholic, with a large segment of the population belonging to an indigenous Bosnian Church ( krstjani , "Christians"). The Krstjani were considered heretics by both the Roman Catholic Church and the Orthodox Church . Modern historians have debated whether the Krstjani were a branch of the Bogomils , a Manichean sect which originated in Bulgaria, or whether they were members of the Catholic Church who had acquired some heretical beliefs and influences from Eastern Orthodoxy and fell into Schism. Part of the resistance of the Bosnian Church was political; during the fourteenth century, the Catholic Church placed Bosnia under a Hungarian bishop, and the schism may have been motivated by a desire for independence from Hungarian domination. Because of Bosnia's mountainous and inaccessible terrain and its remote location on the borderland between the Catholicism and Eastern Orthodoxy, control by church authorities was weak. Historically it was thought that the Krstjani, who were persecuted by both the Catholics and the Orthodox, accounted for many of the converts to Islam. However, such an opinion is largely discredited among contemporary scholars (John Fine, Noel Malcolm, Maja Miletic, Srecko Dzaja) who pointed out that the number of adherents of Bosnian Church in the eve of Ottoman invasion did not surpass several hundred men and women and that the process of Islamization took more than three centuries.

Although the Ottomans did not, as a rule, actively seek to convert their Christian subjects to Islam, it is thought that the greater rights afforded to Muslims in the Ottoman Empire motivated Christians to convert to Islam. The Ottomans imported their feudal system to Bosnia after the conquest, and estates were granted to men, called spahis , in return for military service in times of war. At the beginning of the Ottoman period, these estates were usually, but not exclusively, granted to Muslims, and later only to Muslims. In Bosnia, these land grants gradually became hereditary, and by the end of the Ottoman period, a majority of the landowners in Bosnia were Muslims, and most Christians were peasants or serfs (raya). Christian and Jewish subjects of the Sultan paid a 'poll tax' from which Muslims were exempt. Slaves who converted to Islam could petition for their freedom, and it is possible that some of the Christians enslaved during the wars with Austria, Hungary, and Venice converted to Islam in order to secure their release.

Many Christians became Muslims through the devsirme system, whereby Christian boys were gathered from the Ottoman lands and were sent to Istanbul to converted to Islam and be trained as Janissary troops, servants of the Sultan or Ottoman officials. The system began in the fifteenth century and had ceased to operate by the middle of the seventeenth century, when the Ottomans shifted to a paid professional army and the title of Janissary became a symbol of rank. However, Jannisaries served throughout the Ottoman Empire , and their descendants live throughout the former Ottoman lands. They had no right to marry until 1566 , and even then could not marry until their retirement, although some Janissaries did return to Bosnia to raise families. Janissary settlers probably did not influence the demographics of Bosnia sigificantly, although many of Bosnia's Pashas and other officials were of Bosnian Christian origin through the devsirme system.

As the Ottoman Empire began to contract after the defeat at Vienna in 1683, many Muslim refugees from the lost Ottoman territories in Croatia, Slavonia, Hungary, and, later, Serbia found refuge in Bosnia, and were assimilated into the local Bosniak population.

Traditionally, the Turkish authorities classed subjects of the Empire not by nationality, but by religion. During the nineteenth century, modern national consciousness began to increase among the south Slavs; some historians now believe that it was in this period that Catholic Bosnians increasingly began to think of themselves as Croats, and Orthodox Bosnians as Serbs. The beginnings of a Muslim Slav national consciousness is also first attested in the late nineteenth and early twentieth centuries, as these early Bosniak nationalists began to assert a national identity distinct from both their Orthodox and Catholic neighbors, and from the other Muslim inhabitants of the empire. Some Serb and Croat nationalists tend to deny a separate Bosnian (later Bosniak) national identity, instead claiming that Bosniaks were either Serb or Croat in origin, but of Muslim religion. This debate, whether Bosnia and the Bosniaks are "really" Croats, Serbs, or a separate Bosnian/Bosniak nation, has energized debates among nationalists until the present day.

Bosnia and Herzegovina were occupied and administered by Austria-Hungary in 1878, and a number of Bosniaks left Bosnia and Herzegovina. Official Austro-Hungarian records show that 56,000 people emigrated between 1883 and 1920, but the number of emigrants is probably larger, as the official record doesn't reflect emigration before 1883, nor include those who left without permits. Most of the emigrants were probably Bosniaks, who either had no desire to live under Christian rule or fled in fear of retribution after the intercommunal violence of the 1875-1878 uprising. Many Serbs from Herzegovina left for America during the same period. One geographer estimates that there are now 350,000 "Bosniaks" in Turkey, although that figure includes the descendants of Muslim Slavs who emigrated from Serbia and Montenegro as well. Another wave of emigration occurred after the end of the First World War , when Bosnia and Herzegovina became part of the Kingdom of Serbs, Croats, and Slovenes , known after 1929 as Yugoslavia.

Being part of Europe and influenced not only by the Eastern but also by the Western culture, Bosnian Muslims are considered to be some of the most modern Islamic peoples of the world. Urban Bosniaks especially were proud of their cosmopolitan culture, especially in the capital, Sarajevo, which was, until WWII , home to thriving Bosniak, Serb, Croat, and Jewish communities. After 1945, Sarajevo became one of the most ethnically mixed cities in the former Yugoslavia. The nation takes pride in the melancholic folk songs sevdalinke , the precious medieval filigree manufactured by old Sarajevo craftsmen, and a wide array of traditional wisdoms that are carried down to newer generations by word of mouth, and in recent years written down in numerous books.

1968 saw the first official identification of the Yugoslav Muslims as a unique nationality. The term " Muslims as a nationality " ( Muslimani u smislu narodnosti ) was officially adopted.

In September 1993, the Congress of Bosnian Muslim Intellectuals adopted the term Bosniak instead of the previously used Muslim. Some Serbs objected to the name as a ploy to monopolize the history of Bosnia and make them seem to be foreign invaders (see History of Bosnia and Herzegovina ). The term in itself means Bosnian and is an archaic term that was once used for all inhabitants of Bosnia regardless of faith. Since the 1990s , the name has been adopted outside of Bosnia itself, onto Serbia 's and Macedonia 's Slav Muslim population. It allows a Bosniak/Bosnian distinction to match the Serb/Serbian and Croat/Croatian distinctions between ethnicity and residence.