The history of Madagascar started from the ancient supercontinent of Pangaea, containing amongst others the African continent and the Indian subcontinent, and by the island's late colonization by human settlers from South Borneo, Indonesia and from East Africa. These two factors facilitated the evolution and survival of thousands of endemic plant and animal species, some of which have gone extinct or are currently threatened with extinction. Trade in the Indian Ocean at the time of first colonization of Madagascar was dominated by Indonesian ships, probably of Borobudur ship and K'un-lun po types.

Over two thousand years, the island has received waves of settlers of diverse origins, primarily Austronesian and Bantu. Centuries of intermarriages between both groups created the Malagasy people, who are roughly an equal mixture of both groups. They speak Malagasy, an Austronesian language with Bantu, French and Arabic influences.

By the Middle Ages, over a dozen distinct ethnic identities had emerged on the island, typified by rule under a local chieftain. Some communities, such as the Sakalava, Merina and Betsimisaraka, were unified by leaders who established kingdoms, which gained wealth and power through commerce with Europeans and Arabs. Between the 16th and 18th centuries, pirate activity in the coastal areas of Madagascar was common. The Sakalava and Merina kingdoms in particular exploited European trade to strengthen the power of their kingdoms, trading Malagasy slaves for European firearms and other goods. Beginning in the early 19th century, the British and French competed for influence in Madagascar.

By the turn of the 19th century, King Andrianampoinimerina had reunited the highly populous Kingdom of Imerina in the central highlands, with its capital at Antananarivo. His son Radama I the Great expanded its authority to the island's other polities and was the first Malagasy sovereign to be recognized by foreign states as the ruler of the greater Merina Kingdom. During the rule of Queen Ranavalona I (r. 1828–1861), the kingdom was further expanded to encompass most of the island. Madagascar's population is estimated to have declined by half from 5 million to 2.5 million between 1833 and 1839 from war, disease, slavery, and other violence. She also attempted to eradicate European and Christian influence in the country.

Christianity was made the state religion under Queen Ranavalona II (r. 1868–1883). In the 1880s, Britain recognised France's authority on the island. This led in 1890 to the Malagasy Protectorate, which was however rejected by the Kingdom of Madagascar, which led to the two Franco-Hova Wars which ended with France capturing the capital in September 1895. Conflict continued in the Menalamba rebellion against French rule that was defeated in 1897. The monarchy was dissolved, and the queen was exiled. Following conquest, the French abolished slavery in 1896, freeing approximately 500,000 slaves.Shillington (2005), p. 878

During French rule, Malagasy people were required to fulfill corvée labor on French-run plantations while access to education or skilled positions were limited, although basic services like schools and clinics were extended across the island. Several militant nationalist secret societies emerged in opposition to French rule, of which the most prominent was Vy Vato Sakelika formed in 1913. Many Malagasy were conscripted to fight for France during the First (1914–1918) and Second World Wars (1939–1945), and during the latter Madagascar came under Vichy French control before being captured by the British in the Battle of Madagascar and returned to Free French control in 1942. In 1944, Madagascar became an overseas territory with representatives in the French National Assembly. Militant nationalists launched a large uprising in 1947 that was brutally suppressed by 1949.

The country gained full independence from France in 1960. Madagascar's First Republic (1960–1972) was established as a democratic system modeled on that of France and led by President Philibert Tsiranana. Popular unrest led to the socialist Democratic Republic of Madagascar under Admiral Didier Ratsiraka (1975–1992) distinguished by economic isolationism and political alliances with pro-Soviet states. By 1992, free and fair multiparty elections were held, ushering in the democratic Third Republic (1992–2009). Under the new constitution, the Malagasy public elected successive presidents Albert Zafy, Didier Ratsiraka, and Marc Ravalomanana. This latter was ousted in the 2009 Malagasy political crisis by a popular movement under the leadership of Andry Rajoelina. Elections were held on December 20, 2013, to elect a new president and return the country to constitutional governance.

First inhabitants and settlements (500 BCE–700 CE)

Archaeological evidence for date of first settlement

The earliest unambiguous evidence of continuous human presence in Madagascar was found at Andavakoera and dates to 490 CE,'The archaeological evidence for the earliest human presence in Madagascar comes from Andavakoera near Diego Suarez and is dated to AD420 (AD250-590, 2SDs) (Dewar & Wright 1996). and there is no archaeological evidence for human occupation in the highlands until around 1200. However, there is scattered evidence for much earlier human visits.

In 2009, archaeological excavations at Christmas River (south-central Madagascar) by Pat Wright and James Hansford located a purported elephant bird kill site, with bones showing human cut marks. These were dated to 8,500 BCE, but as yet there is no indication as to the identity of the hunters. Archaeological finds such as cut marks on bones found in the northwest and stone tools in the northeast indicate that Madagascar was visited by foragers around 2000 BCE.

There is potential evidence in the form of a cutmarked subfossil lemur bone from a palaeontological site, Taolambiby, in the southwest. One date was obtained, calibrated 530 to 300 BC (Godfrey & Jungers 2003). The cutmarking looks plausible, but there is a potential problem of old carbon from the limestone landscape compromising the date, and there are no associated artifacts or archaeological sites in the vicinity. Nearly contemporaneous potential evidence comes from cannabis or humulus pollen which occurs in a pollen column from the central highlands at an interpolated date of c. 2200 Before Present (BP).Burney 1987 There is a hypothesis that cannabis may have reached Africa 3000 years ago.

Necho II's Phoenician expedition c. 595 BCE circumnavigated Africa but did not see Madagascar when passing through the Mozambique Channel, as it stayed within sight of the African mainland. The island was likely uninhabited.

Finally, a cutmarked pygmy hippo bone from Ambolisatra has been dated and calibrated to between 60 BC and 130 AD (2 SDs), but it is from a coastal swamp without indications of settlement in a heavily karstic region. Moreover, a similar bone from the same collection from a nearby site gave two widely divergent dates of 2020 and 3495 BC (MacPhee & Burney 1991). Transient visits to Madagascar that did not result in enduring settlement cannot be ruled out, and may have left some traces.Peter Forster, Shuichi Matsumutra, Matthieu Vizuete-Forster, Petya Belinda Blumbach & Robert Dewar (2008) "The Genetic Prehistory of Madagascar's Female Asian Lineages", In: , pp71-72

A common Austronesian origin: The Vahoaka Ntaolo Factual information about the peopling of Madagascar remains incomplete, but much recent multidisciplinary research and work in archaeology,Burney et alii (2004) genetics,Hurles et alii (2005) linguistics,Dahl O. (1991)Adelaar, K.A. (2006) and historyStaff (May 4, 2005) "The cryptic past of Madagascar" Wellcome Trust Sanger Institute, citing Verin (2000), p.20 confirms that the Malagasy people were originally and overwhelmingly Austronesian peoples native to the Sunda Islands. They probably arrived on the west coast of Madagascar with outrigger canoes (waka) at the beginning of our era or as much as 300 years sooner according to archaeologists,Burney et al, op. cit. and perhaps even earlier under certain geneticists' assumptions.Ricaut et al, op. cit. On the basis of plant cultigens, Blench proposed the migrations occurred "at the earliest century BCE".Blench, Roger. “The Ethnographic Evidence for Long-distance Contacts Between Oceania and East Africa” In The Indian Ocean in Antiquity, edited by Julian Reade, pp. 417–38. London: Kegan Paul/British Museum 1996 pp. 417–38. Archaeological work of Ardika and Bellwood suggests migration between 500 and 200 BCE.I. W. Ardika & P. Bellwood, “Sembiran: The Beginnings of Indian Contact with Bali”, Antiquity 65 (1991): 221–32.I. W. Ardika, P. Bellwood, I. M. Sutaba & K. C. Yuliati, “Sembiran and the First Indian Contacts with Bali: An Update”, Antiquity 71(1997): 193–95.

The Borobudur Ship Expedition in 2003–2004 confirmed scholars' ideas that ships from ancient Indonesia may have reached Madagascar and the West African coast for trade as early as the 8th century. Samudra Raksa, a traditional Borobudur ship with outriggers, was reconstructed and sailed in this expedition from Jakarta to Madagascar and Ghana. As for the ancient route, one possibility is that Indonesian Austronesians came directly across the Indian Ocean from Java to Madagascar. It is likely that they went through the Maldives, where evidence of old Indonesian boat design and fishing technology persists until the present.P. Y. Manguin. Pre-modern Southeast Asian Shipping in the Indian Ocean: The Maldive Connection. ‘New Directions in Maritime History Conference’ Fremantle. December 1993. The Malagasy language originated from the Southeast Barito language, and the Ma'anyan language is its closest relative, with numerous Malay and Javanese loanwords.Otto Chr. Dahl, Malgache et Maanjan: une comparaison linguistique, Egede-Instituttet Avhandlinger, no. 3 (Oslo: Egede-Instituttet, 1951), p. 13.There are also some Sulawesi loanwords, which Adelaar attributes to contact prior to the migration to Madagascar: See K. Alexander Adelaar, “The Indonesian Migrations to Madagascar: Making Sense of the Multidisciplinary Evidence”, in Truman Simanjuntak, Ingrid Harriet Eileen Pojoh and Muhammad Hisyam (eds.), Austronesian Diaspora and the Ethnogeneses of People in Indonesian Archipelago, (Jakarta: Indonesian Institute of Sciences, 2006), pp. 8–9. It is known that Ma'anyan people were brought as laborers and slaves by Malay and Javanese people in their trading fleets, which reached Madagascar by ca. 50–500 AD. These pioneers are known in the Malagasy oral tradition as the Ntaolo, from Proto-Malayo-Polynesian *tau-ulu, literally 'first men', from *tau, 'man', and *ulu, 'head; first; origin, beginning.Randriamasimanana, "The Malayo-Polynesian Origin of Malagasy" It is likely that those ancient people called themselves *va-waka, "the canoe people" from Proto-Malayo-Polynesian *va, 'people', and *waka 'canoe'. Today the term means 'people' in Malagasy.

The Southeast Asian origin of the first Malagasy people explains certain features common among the Malagasy, for instance, the epicanthic fold common among all Malagasy, regardless of coastal or highlands origin or skin color. This original population (vahoaka ntaolo) can be called the "proto-Malagasy". They are the source of: the Malagasy language, common to the whole island, which shares many common roots with the Austronesian languages of Barito subgroup, which originated in South Kalimantan, such as Ma'anyan.O. Dahl, op. cit., Adelaar, op. cit., Simon, op. cit.