People first settled Abeokuta (meaning "under the rocks") in 1825 as a place of refuge from slavehunters from Dahomey and Ibadan. The village populations scattered over the open country to take refuge among the rocks surrounding the city. Here they formed a free confederacy of many distinct groups, each preserving the traditional customs, religious rites and the names of their original villages.
The original settlers of Abeokuta were of the Egba nation. Later, some members of other Yoruba clans came to the settlement. Baptist and Anglican missionaries from Great Britain began to serve the area in the 19th century.
In 1851 and 1864, the forces of Abẹokuta defeated Dahomean slave raiders.
In 1893, the Egba United Government based in Abẹokuta was recognized by the United Kingdom. In 1914, the city was made part of the colony of Nigeria by the British