Beginning sometime after the 12th century, a number of small kingdoms arose in what is now Benin. Portuguese slavers arrived in the 16th century. They were followed by the Dutch, French, and English, who set up slave-trading posts on what became known as the Slave Coast.

In the 17th century, the Fon, who were centered around Abomey, founded the Dahomey kingdom. The kingdom built its economy on the selling of slaves to European slave traders. Under the kings Gezo (reigned 1818–58) and Glele (1858–89), Dahomey maintained one of the strongest and best-organized armies in West Africa. Following the suppression of the slave trade in the 1850's King Glele developed a thriving export market in palm oil.

In the late 1800's the French took an interest in Dahomey, and in 1892 they conquered the Fon and deposed the king, Bahanzin. In 1904, Dahomey was made part of French West Africa. Dahomey achieved independence in 1960. Ethnic conflict and political rivalry, however, led to a period of instability in the following decade, and the army overthrew the government several times.

A military regime headed by Major Mathieu Kerekou came to power in 1972 and established a dictatorial government. Kerekou declared Dahomey a Marxist-Leninist state in 1974 and nationalized private business. In 1975 Kerekou renamed the country Benin after a medieval African kingdom. He was elected president in 1980 and reelected in 1984 and 1989.

Dissatisfaction with Kerekou's regime culminated in a conference held in 1990 at which opposition leaders stripped Kerekou of power. A democratic constitution was adopted by referendum and in presidential elections in 1991 Kerekou was unseated by Nicephore Soglo. In 1996 elections, after years of labor and student unrest, Kerekou was returned to the presidency. Kerekou was reelected president in 2001 and retired in 2006. Yayi Boni was elected to succeed him.