The stock-market rally that has lifted major indexes to new highs in 2017 has hit its choppiest patch, reflecting both uncertainty over the fate of the pro-business Trump economic agenda and stocks’ vulnerability to reversals at a time of above-average valuations.

The S&P 500 fell 1.4% in the past week, its biggest loss since the week ended Nov. 4, the week before the U.S. election. The struggle of the Trump administration and congressional Republicans to pass a health-care bill to replace the Affordable Care Act spurred...