Oddly, even though freestyles are a foundation for modern day hip-hop, lots of rappers along the way didn't acknowledge the importance of this art form and consequently they suffered commercially. The exact definition of freestyling hasn't been pinpointed.
Some rappers consider it just rhyming a written verse over any given beat.
Others define it as having general ideas planned ahead of time, but the lyrics themselves being created on the spot. During the earliest days of hip-hop when Jamaican DJ Kool Herc and his Herculoids began to DJ parties, their performances were largely improvised. So in other words be with it. While having pre-written lyrics was OK, if a rapper couldn't make up a rhyme on the spot about his opponent, he wasn't going to win the respect of a crowd. However, the artists that did freestyle at the time, like Biz Markie, Rakim, and KRS-One, are the ones that went on to continue making records up to this day.