U.S. corporations are repurchasing their own shares at the slowest pace in 18 months, a potential sign of more volatility as the buyback bonanza from the corporate-tax overhaul wanes.

Companies in the S&P 500 repurchased about $166 billion of their own stock in the second quarter, S&P Dow Jones Indices projects, down from $205.8 billion in the first quarter and $190.6 billion in the same period a year ago. That marks the lowest total since the fourth quarter of 2017 and the second consecutive quarter of contraction.

What...