Following the opioid-related death of Los Angeles Angels pitcher Tyler Skaggs, Major League Baseball is revising its response to an epidemic that has swept the nation.

The league and its players’ union are negotiating changes to their collectively bargained drug policy that would for the first time include random testing of all players for opioids, like oxycodone and fentanyl. The two sides hope to reach an agreement before the end of the year.

If...