Most royal families around the world use male primogeniture to determine inheritance. On October 28, 2011, the sixteen Commonwealth countries at the Perth Commonwealth Summit voted unanimously to scrap male primogeniture in the British royal family. Henceforth, the oldest child in the direct line would be heir, regardless of gender. To understand why this change happened now and not earlier, it's important to understand how male primogeniture works and why male primogeniture exists in the first place.
How male primogeniture works
The form of male primogeniture practiced in Great Britain is called male preference cognatic primogeniture. In this system, the oldest male child is the heir apparent and will inherit the throne. If he dies before inheriting the throne but after having legitimate children, his oldest son will inherit. His brothers are not eligible until he has no more descendants or unless he abdicates his own right and that of his line, as Edward VIII did to marry Wallis Simpson.
If the oldest child is a daughter, she can become monarch, but only if she is the oldest child and has no brothers. If a daughter is born first, she is only heir presumptive until either her royal parent dies or a son is born.
This is why Queen Elizabeth II has never been Princess of Wales. Although it is standard for British heirs apparent to be made Prince of Wales, Princess Elizabeth was only heir presumptive, because she could be supplanted by the subsequent birth of a son to George VI. No son was ever born, so Princess Elizabeth became Queen Elizabeth without ever having been Elizabeth, Princess of Wales.
Under this system, a female child could be the heir apparent if she is the oldest child of the monarch's oldest son, if that son dies without fathering a son. It's possible. It's just never happened, and now in Great Britain, it never will.
Other, even stricter forms of male primogeniture exist. Until Queen Victoria, the crowns of Great Britain and Hanover were held by the same person. They split in 1837 because under the semi-Salic law used in Hanover, Victoria was not eligible for the Hanover crown. Instead, it went to her father's brother, Ernest I. According to semi-Salic law, also known as agnatic primogeniture, the oldest surviving male heir always inherits, even if it takes the inheritance out of the direct line of descent.
If Great Britain practiced semi-Salic law, Elizabeth could not have become queen. Instead, the title would have gone to Prince Henry, Duke of Gloucester, who was George VI's next-eldest brother, and to Henry's oldest son after that.
Why is male primogeniture so common?
Most monarchs are also the heads of their armed forces. In the Middle Ages and earlier, a monarch was expected to lead troops on the field. Until the end of World War I, many monarchs were still expected to be military commanders, a position which is traditionally male.
In monarchies which are closely linked to religion, the monarchy itself has a religious role. Queen Elizabeth is the head of the Church of England, and is required by law to be of the Anglican faith. This is possible partly because Anglicanism allows female ministers. However, in other cases, the religious role may be one which is banned to women.
Changing to equal primogeniture
After World War I, the military command of the monarch became mostly symbolic, which is a role women can fill as well as men. However, in many strongly Roman Catholic countries with surviving monarchies or principalities, male primogeniture still dominates.
The Scandinavian countries, along with Belgium, Luxembourg, and the Netherlands, were the first European countries to abolish male primogeniture in favour of equal primogeniture. Each of these countries has a strong Protestant tradition.
Great Britain now joins them, along with the Commonwealth of Nations which recognizes Queen Elizabeth II as their queen. In announcing the change, British Prime Minister David Cameron explained that the historic rules "are at odds with the modern countries that we have become."
The direct practical outcome of the change has to do with Prince William's children. His oldest child will now be next in line for the throne, whether that child is a boy or a girl.
Things could have been much different if equal primogeniture had existed earlier in Great Britain. If equal primogeniture had applied during Queen Victoria's time, the throne after her would have gone to Princess Victoria instead of to King Edward VII. From there, it would have gone to her oldest child, Kaiser Wilhelm II, who ruled over Germany during World War I!