They were built because SpongeBob needed them to escape from the jellyfish that wouldn't leave him alone. They wouldn't leave him alone because a strong wind was blowing, and it made a tune when it blew through SpongeBob's holes that jellyfish seem to love. The jellyfish wouldn't leave SpongeBob alone, thus preventing him from going about his day. He tried to flee, but the jellyfish kept on following him, forcing SpongeBob to take refuge in a cave where the wind didn't blow. SpongeBob decided just to wait in the cave until the wind stopped blowing, but it never seemed to stop. He eventually made a stone carving of himself out of insanity. When SpongeBob blew into one of its holes, he discovered that it made a tune. When he tried to use it to distract the jellyfish, it only made a shrill noise that made them angry. SpongeBob had concluded that he needed to make another stone carving of himself in a different size, but he didn't know how big to make them, so he made a bunch of them. He ended up making a bunch of large ones and put them in a circle. Their tune was perfect, and the soothing melodies they produced were successful in distracting the jellyfish, allowing SpongeBob to finally make a hasty retreat.
3,000 years later, a race of light purple aliens is seen, and the statues are now a tourist attraction. The aliens don't know who built the henge or why they were built, they only know that their tune causes the annual migration of jellyfish to fall in love with the sound. You can hear SpongeBob's laugh in one of the statues.
The circle of SpongeBob statues is a parody of Stonehenge.
SpongeBob makes a lot of statues because he doesn't know which one is the right size, but they all end up being the same size.