U.S. Supreme Court Justice Anthony Kennedy announced he will retire, letting President Donald Trump nominate a successor who could create the most conservative court in generations and put the landmark Roe v. Wade abortion-rights ruling at risk.

The court said June 27 he will retire effective July 31.

Kennedy, an 81-year-old Ronald Reagan appointee, has been the court’s pivotal vote for the last decade, joining liberal justices to recognize same-sex marriage and voting with conservatives to throw out campaign finance...