There are three stories about how this got started:
If a 20 round magazine was disassembled and reassembled with the spring connected to the follower backwards, it wouldn't feed reliably when fully loaded due to the spring binding in the mag. Downloading the magazine to 18 became a habit in some circles "just in case," though eventually this problem was discovered, and solders were instructed never to separate the follower from the spring, which virtually eliminated this problem.
Many magazines can be loaded without obviously excessive force to 21 rounds, and because ammo was issued loose in boxes during the early Vietnam era, this happened frequently. The result was often that the first round wouldn't chamber because it was held too tightly in the magazine. This is not a good thing in a firefight, so early in the history of the M16 it became habit to teach shooters to load 18 in a 20 rounder just to be safe. Again, the root cause was eventually addressed, and ammo began to be issued on stripper clips, which eliminated the need to count individual rounds when loading mags.
Some tactical squads download their back-up magazines by one round to make a tactical reload (which is done with a round chambered and the bolt forward) easier. This is because of the reduced upward pressure on the rounds.
#3 is probably the only real reason to consider downloading your magazines, though it is generally not necessary.
It's probably better to just keep track of how you load your mags. Remember that in an AR15 magazine loaded with an even number of rounds, the top round will always be on the right when the bullets are pointed away from you.