Corporate buybacks are "plummeting" as companies tighten their purse strings, and it could have a big impact on the market, Goldman Sachs warned in a note to clients.

In the second quarter, S&P 500 share buybacks totaled $161 billion, about 18% less than the first quarter, the firm found. The amount spent on buybacks this year is down 17% from a year earlier, although it is on track to be the second highest total on record, Goldman said.

The firm anticipates that this trend will continue, saying "early indications suggest second-quarter weakness in buybacks may persist."

For 2019, total buybacks will drop 15% to $710 billion, and in 2020 they see a 5% decline to $675 billion, the firm predicted.

Share repurchases have been a key element during this bull market, the longest on record. By repurchasing shares, a company reduces the number of shares outstanding. It can have the effect of boosting the stock price and lifts earnings per share figures.