Not every league has divisions in fantasy football, but what's the reason for it for leagues that do have divisions? The simple answer is for an easy way to organize teams as well as tell who is going to make the playoffs. Most deep leagues (leagues of more than 12 owners) are divided into at least two divisions. The only requirement is that there are at least two teams in each division to allow for competition.
Depending on the league settings, often the top four or top six teams in the league make the playoffs. In a league with two divisions, it would be either of the top or top three from each division making the playoffs. In all formats the division winner automatically makes the playoffs with the remaining playoff spots being the next best teams.
So instead of having to take into consideration the outcome of every game for every team in a given week to find out if you will make the playoffs, you only need to look at the short list (teams in your division) and it's easy to spot which position you need to be in to make the playoffs.
Most leagues seperate teams into divisions randomly when an owner first joins the league. Online sites will do that for you, and that is the default setting. Although, league settings can be altered to pick divisions. This is most common in dynasty leagues that run for more than one year.
In dynasty leagues there can be set divisions as well as divisions chosen by previous year's records. Divisions can remain constant the same way real football divisions do, you have the same division opponents every year. The divisions can also be chosen based on the previous year's win-loss records, evening the league by balancing the skill levels in each division.