French pharmaceuticals company Sanofi SA has been making drug-shortage contingency plans for more than a year to prepare for the U.K. failing to reach a deal with the European Union on Brexit, according to a person familiar with the matter.

The move is the latest sign large European companies are worried about the prospects of a hard Brexit, where the U.K. doesn’t reach a deal over its future relationship with the European Union, despite repeated attempts at reassurance from British government officials.

A...