CVS Health said on Sunday that it had agreed to buy Aetna for about $69 billion in a deal that would combine the drugstore giant with one of the biggest health insurers in the United States and has the potential to reshape the nation’s health care industry.

The transaction, one of the largest of the year, reflects the increasingly blurred lines between the traditionally separate spheres of a rapidly changing industry. It represents an effort to make both companies more appealing to consumers as health care that was once delivered in a doctor’s office more often reaches consumers over the phone, at a retail clinic or via an app.

The merger comes at a time of turbulent transformation in health care. Insurers, hospitals and pharmacy companies are bracing for a possible disruption in government programs like Medicare as a result of the Republicans’ plan to cut taxes. Congress remains at an impasse over the future of the Affordable Care Act, while employers and consumers are struggling under the weight of rising medical costs, including the soaring price of prescription drugs. And rapid changes in technology have raised the specter of new competitors — most notably Amazon.

A combined CVS-Aetna could position itself as a formidable figure in this changing landscape. Together, the companies touch most of the basic health services that people regularly use, providing an opportunity to benefit consumers. CVS operates a chain of pharmacies and retail clinics that could be used by Aetna to provide care directly to patients, while the merged company could be better able to offer employers one-stop shopping for health insurance for their workers.