A minaret was a tower that Islamic holy men called muezzins climbed in order to call out the call to prayer, five times a day. It was a tall thin building with stairs inside it (or sometimes outside) and small windows to let in daylight. At the top, there was an opening for the muezzin (moo-EZZ-in) to call out the prayers so everyone would know that it was time to pray.
Most minarets were near mosques, where men (though not women) came to pray.
The oldest minaret that is still standing is the one you see here from the Great Mosque at Kairouan, in North Africa, which was built during the 700s AD. Another early minaret is the one from the Great Mosque at Samarra, which was built in the 800s AD.
It’s possible that the architectural inspiration for the earliest minarets came from Buddhist pagodas in China, which were first built in wood about 200 AD (themselves modelled on Han Dynasty watchtowers), and then began to be built in stone around 500 AD.
When the Almovarids ruled North Africa and Spain, they disapproved of minarets, and so people built mosques without minarets in those areas during the 1000s AD. But when the Almohads conquered the Almovarids, they built a lot of minarets to show that they had won.