The theory most often uttered is that men used to dress themselves, while women had the help of a maid. Since most people are right-handed, the buttoning was inverted for the sake of the maid.
Another theory says that women were forced to button themselves using the inferior hand, in order to show them that they themselves were inferior (to men, of course). This theory is based on the assumption that women buttoned their own dress, thus inherently contradicting the first theory.
Both theories are IMO somewhat shaky. The former implies that a significant part of the female population had a maid available. N.B.: "Significant" does not necessarily mean "numerous", but "influential". Depending on the era we're looking at, the rich were the significant ones - the ones who made fashion - and they had maids. But does their influence also extend to such insignificant details as buttoning? The second theory is somewhat medieval. Misconceptions about female inferiority did exist until the early 20th century, but in the main the 18th century did away with most of them.
Both theories assume that the preference for one hand plays a role. Being left-handed, I readily complain about anything that makes life unnecessarily difficult for lefties, but I have never felt that buttoning, whichever way around, was a problem. You nomally use both hands, anyway - the rest is a matter of habit rather than of motoricity.
"Depending on the era": Which era are we looking at, anyway? Since when does the gender-related right-left distinction exist? If we know when the distinction was first made, we may discover the reason. So let's look at historical depictions.
Until the late 18th century, buttons are rare on women's dress. In the few earlier pictures, the direction often can't be determined. At least I've found one 14th century example where the buttons seem to sit in the right-hand edge (i.e. the "male" side), and two ditto examples from the 17th century. In the late 18th century, we find buttons on female dress relatively often, e.g. on comperes, jackets and redingote dresses. In every case, the buttons sit on the right side. In the 1830s, buttons are rare on women's clothes and evenly distributed between right and left, then nothing until the 1850s. During the 1850s, left sligthtly outweighs right. From the late 1860s on, buttons are quite common on women's dress - all left.
So the changeover from "mostly right" to "mostly left" must have taken place between 1810 and 1860, with nothing definitely decided yet until 1860. Since the middle of the 18th century, the production of women's clothes was largely in the hands of female artisans - would they have taken part in a scam that degrades women as in the second theory? And if they did, why did they stick with the "male" right-side buttoning for over 50 years? Maids did exist in the 18th century as mich as they did later, so why did it take 100 years until the buttoning was switched (according to the first theory) for their sake? Why should anyone do anything for the sake of the servants, anyway? Moreover, in the 17th and 18th century, there should have been as many men who had a manservant as there were ladies who had a maid. With the many buttons on the waistcoats and coats of the time - the closing of the lower ones required the wearer to bend -, one should assume that men, too, had help for dressing. If the buttoning was switched for the sake of the servants, why was it done for the maids, who may have had to close a few buttons every now and then, but not for the manservants, who had to close dozens of buttons every day for sure?
There's a good hint by Janet Arnold referring to the fashion of the late 19th and early 20th century: As if to make up for the fact that clothing could be more easily made with the help of the sewing machine, the construction was made more complicated by adding trims (Patterns of Fashion 2, p. 4). A few years later Thorstein Veblen published his "Theory of the Leisure Class" (1899) according to which it was the main role of late 19th century women to demonstrate wealthiness by being demonstratively, conspicuously unproductive. Requiring an hour or more for dressing and not being able to dress without the help of a maid would definitely count as being unproductive, so a "wrong way around" buttoning could have been a code telling those in the know that "I have a maid to help me dress!" That would fit nicely with the beginning of left-hand buttoning, but wouldn't have buttons in back, which were used as early as the 1810s, put the point across much more obviously?
Moreover, the late 19th century happened to be the very time when women started to think about such things as emancipation and equality. One of the means they used was the adoption of features of male dress. If left-hand buttons had symbolised female inferiority, it would probably have been given up quite early. This relatively unspectacular feature would have allowed even the moderately modern-minded women to express their opinion without causing a scandal. But quite contrary: The era when emancipation is first expressed in clothing (the 1849 Bloomer costume) is roughly synchronous to the era when mainly-right buttoning makes way for mainly-left.
This leads me to a completely new* theory: Since female clothing took on more and more features of male clothing in order to express emancipation (a process that, I'd like to point out, most contemporaries were not aware of), it became necessary to establish a feature that signalled that an item of clothing was, despite its male appearance, nevertheless female. Otherwise someone could be led to believe that the lady wore a man's coat, a man's shirt etc., and use that as a a moral handhold against her since wearing the clothing of the opposite sex was immoral. The closer female clothing got to male clothing, the more important the "little difference" of buttoning became. At the end of the 20th century, the buttoning was often the only thing that differentiated a female blouse from a male shirt.
My personal theory, therefore, is that the right-left-differentiation is a result of the gradual approximation of female and male dress and the resulting necessity of distinction.