Politics and business may be well acquainted behind closed doors and in backrooms, but out in the light of day, corporate America is in the business of attracting customers--not advocating social change.

Why would any company come out on one side of a divisive social issue and risk alienating all those paying customers who disagree? And for that matter, why would 48?

That's how many companies, including behemoths such as Boeing, Microsoft, and Google, as well as relative upstarts like games-maker Zynga, have signed on to an amicus brief opposing the federal Defense of Marriage Act, which defines marriage as a union between a man and a woman. They claim DOMA puts unfair burdens on company HR departments, which effectively have to keep two sets of books for federal and state benefits for same-sex couples. (It should be noted that North Carolina–based companies largely sat out the recent fight over gay marriage there.)

You could call this a recruiting issue, and argue that in a highly competitive market for top talent no corporation can afford to alienate candidates on account of their sexual orientation. But that argument has existed for as long as talented gay job seekers have expected fair treatment, which has been the case for a lot longer than corporations have been willing to wade into this debate.

Just five years ago, any company that came out in support of same-sex marriage would face a predictable and intense backlash from social conservatives, and that was enough to keep most of them quiet on the issue, Politico has noted, quoting Beth Boland, an attorney who worked on the latest brief in opposition to DOMA: "I see a seismic shift in the business community in the last five to 10 years. I can’t even begin to state how different these issues are perceived within the business community."

So what's causing this seismic shift? A useful analogy might be found in the history of corporate attitudes toward environmentalism, which Andrew J. Hoffman chronicled in his book From Heresy to Dogma: An Institutional History of Corporate Environmentalism.

"A 1974 Conference Board survey," he writes, "found that the majority of companies treated environmental management as 'a threat.'" But by 1991, another survey by the Conference Board "found that 77 percent of U.S. companies had a formal system in place for proactively identifying key environmental issues."

Another seismic shift, in other words. What drove it? There are significant differences between gay rights and environmental awareness, of course, but Hoffman's answer to this question still sheds some light on corporations' evolving attitudes toward gay marriage. In short, he argues, firms don't exist in a bubble--social context is key.

"In the field of organization behavior there is a debate much like the 'nature vs. nurture' controversy in the study of individual behavior--that of 'agency vs. structure,'" he writes.

Are firms autonomous and self-driven (agency) or bound by their social environment (structure)? Do companies just up and change on principle? Nope, says Hoffman, siding with fans of structure, largely they reflect their social context.

"The firm changes within the context of the economic, political, and social system that is itself also changing…How companies define their responsibility toward the environment is a direct reflection of how we, as a society, view the environmental issue," he writes.

And what's true for environmental attitudes is probably also true for gay rights. Why are companies opposing DOMA now? American society should see the move as a mirror. "There is plenty of cultural and social change under way, and the tipping points are accelerating," Bob Witeck, president of Witeck Communications, which advises corporations on LGBT issues, told Inc.

"Businesses see more reward than risk in communicating their acceptance toward LGBT people. Companies that come out against DOMA want to reflect contemporary market attitudes," Witeck says.

But corporate America isn't just reflecting American society; it's also helping to change it. "There's no doubt that American businesses will be central to the dismantling of DOMA," Human Rights Campaign president Joe Solmonese told Politico.