It should be noted that while this is a start, they still don't allow gay troop leaders.
An enormous number of things have changed in western society in the past 250 years that have helped lead to this point.
You could start with the enlightenment era. While subversive philosophers are as old as civilization (see: Socrates, Galileo, and others), is was not considered acceptable to challenge the dogma you were raised with. Afterward, "because [religious book] said so" was no longer an acceptable answer for a large fraction of the population.
This has in part led to a steady secularization of society. 250 years ago, moral enforcement for common people was largely the responsibility of the local community. Your local Priest, Minister or Rabbi determined what was moral, and had relatively few secular checks on that power. As states have become more secular, that power has been stripped from the religious institutions and given to the State.
Advances in communication and public education have also done a great deal of good. Before widespread literacy, you really had no choice but to trust the word of your local authority (usually religious) on issues of ethics and metaphysics. You couldn't go to a public library and read Plato. Ethics for the masses was determined by a combination of religious tradition and a small group of philosophical elite.
On the communication side, most people growing up didn't ever meet anyone outside their village. Thus minorities of other cultures were completely foreign to most. If you were gay but didn't know anyone else who was, you'd probably just forever stay in the closet, afraid that you were the only one and had something evil. In the past 50 years especially, you've seen a rapid change. Once people started to come out around the same time as the civil rights era, younger people saw they were not alone. One that next generation came out in droves, it became a relatively normal part of culture to be gay. Now, you'll be hard pressed to find someone in an urban area of America that doesn't have a close friend or family member that's gay.