The sacred forest, home to Osun, the Yoruba goddess of fertility, is a UN-designated World Heritage Site.
Police said the man, Tobiloba Jolaosho, popularly known as King Tblak HOC, was arrested for allegedly recording a “sex movie” in the forest.
Neither he nor his lawyer have commented.
Osun Osogbo is on the outskirts of the city of Osogbo, the Osun state capital. Mr Jolaosho is a popular porn movie producer with a huge following, and snippets of the video, which allegedly showed him dressed in the white robe of adherents of the Osun deity, were posted on his website and social media accounts.
It is not clear when the recording was done or how he entered the forest, which can be easily accessed from many routes.
Police spokesman Opalola Yemisi said that the movie producer will appear in court following an investigation as his conduct “could have breached public peace”
A follower of the deity, Yemi Elebuibon, said Mr Jolaosho had desecrated the grove, which was a sacred land where worshippers from Nigeria and elsewhere offer prayers and sacrifices to the Osun goddess.
Devotees believe that the sacred grove forest is one of the last remaining places that the spirits, or “Orishas” reveal themselves to bless them.
The festival is marked with daily performances of people dancing, singing, playing the drums and showing off elaborate costumes to appease the goddess Osun.