WASHINGTON—A federal judge, in a Wednesday evening decision, blocked health insurer Anthem Inc. from acquiring rival Cigna Corp., the second court ruling in recent weeks to deal a decisive rebuke to efforts to reshape the industry through megamergers.

The decision, by U.S. District Judge Amy Berman Jackson, said the proposed $48 billion deal violated federal antitrust law because it would create an unacceptable reduction in the number of companies able to serve large multistate employers that insure their workers.

...