About a decade ago, the Humane Society of the United States sent an undercover investigator into an Iowa factory farm with the intention of exposing routine exploitation in the egg industry. That investigation — and the release of footage of countless hens jammed together in cages, unable to move — didn't endear me or anyone else in our organization to the company's executive team.

Yet, last fall, the CEO of that company, Rose Acre Farms, invited me for a tour of its newly built cage-free facility; he informed me that he planned to build more and more of them until not one of his 25 million birds lives in cage confinement.

Welcome to the new humane economy, where yesterday's adversaries are today's allies. Whether it's SeaWorld ending orca breeding or Armani giving up its fur fashions, putting animal welfare into the business plan is no longer viewed as a threat to profits or efficiency, or a capitulation to animal advocates. It's just good business. Doing the right thing is a brand builder, a share builder and a hedge against future risk.

More and more, CEOs are turning a rising tide of social concern about animal welfare into economic opportunities. Indeed, the smart producers realize that it's time to get with the program or get left behind.

The case against cage confinement of hens was clinched earlier this month when Wal-Mart — the nation's largest food retailer by a country mile — announced that it would stop selling eggs from caged hens. With the company selling as many as 15 billion eggs a year, Wal-Mart's decision promises to improve the lives of tens of millions of animals. And it's the signature achievement of a decadelong campaign by the Humane Society to end the era of extreme confinement in industrial agriculture.

The average American consumes 264 eggs a year. Eggs are one of the most versatile food items, typically baked or blended into muffins, cakes, pastas, mayonnaise, cookies and other products. The problem is: The vast majority come from hens crammed into battery cages, bread-boxed-sized enclosures that confine six or eight birds so restrictively that the animals can't even spread their wings. On farms with hundreds of thousands or even millions of birds confined in this manner, cruelty and indifference are ordinary and routine.

Wal-Mart's pledge to dissociate itself from that kind of animal privation hasn't come quickly or easily. Over the years, a few of us at the Humane Society made treks to Bentonville, Ark., to discuss the issue with Wal-Mart's management. With nearly 90 percent of the nation's 300 million hens in cage confinement, Wal-Mart couldn't readily just declare itself cage-free. Where would the eggs come from?

But producers like Marcus Rust at Rose Acre farms saw the writing on the wall and started to re-imagine their business models. They were no longer building confinement sheds, but aviaries and other cage-free facilities. Prior to Wal-Mart's announcement, more than 100 other big names in food retail pledged to source all of their eggs from cage-free hens — an unmistakable signal to producers that it's time to change the way they raise their hens.

The transformation has been seismic. Following the passage of California's Proposition 2 — a ballot initiative to ban extreme confinement systems — companies such as Minnesota-based Cargill began eliminating the use of gestation crates. And, in December 2014 — after a six-year phase-in of Prop 2's provisions — Starbucks pledged to source all of its eggs for its 15,000 outlets from cage-free farms by 2020.

Last September, McDonald's made the switch. Just about every big brand name followed, including Minnesota-based Target, Supervalu and General Mills. Suddenly, there was a "new normal" in the egg industry, and battery cages weren't a feature of it.

Big changes are happening throughout society — in food and agriculture; in the pharmaceutical, chemical and cosmetics industries; in film, television and live entertainment; in tourism and wildlife management; in the pet trade for dogs and cats and exotic wildlife, and in fashion. Collectively, these changes promise to relieve or end the suffering of billions of creatures, while allowing businesses aligned with the best instincts and values of their customers to flourish.

Wayne Pacelle is president and CEO of the Humane Society of the United States and author of "The Humane Economy: How Innovators and Enlightened Consumers are Transforming the Lives of Animals."