“Grocery is being hit by multiple factors,” said Gerald Storch, the former chief executive of the retailer Hudson’s Bay.

The pharmacy business, too, is undergoing major changes, with the nation’s largest operators of drugstores pursuing mergers to control costs and increase profits.

In December, the drugstore giant CVS Health said it would merge with the health insurer Aetna in a $69 billion deal that could reshape the way health care is delivered in the United States. That deal came together after a federal judge blocked Aetna’s proposed merger with rival Humana last year.

Rite Aid had previously sought to bulk up by merging with Walgreens. Negotiations between two of the biggest drugstore chains in the United States ended after antitrust authorities indicated they were unlikely to approve the combination. Instead, Rite Aid agreed last year to sell 1,932 stores and three distribution centers to Walgreens for $4.38 billion.

Amazon’s specter also looms over the health care field. The company recently teamed up with Berkshire Hathaway and JPMorgan Chase to form an independent health care company to serve the three firms’ employees and potentially revamp the broader industry.

For Albertsons, the Rite Aid deal is just the latest step to draw in more customers.

In November, the company reached an agreement with Instacart to provide on-demand grocery-delivery services. It also invested last year in El Rancho Supermercado, a Texas-based retailer focused on stores for Latino customers.

Originally founded by Joe Albertson in Boise, Idaho, in 1939, Albertsons grew primarily across the West. In 2013, it was acquired by a group of investors led by the private equity firm Cerberus Capital Management for about $3 billion.