Several major insurers said they intend to provide health plans on the Affordable Care Act’s exchanges for the rest of this year and for 2018, despite a financial blow from President Donald Trump’s cancellation of federal cost-sharing payments.

The payments, which had been expected to total $7 billion this year, will be “discontinued immediately” because their continuation violates federal law, the Department of Health and Human Services said Thursday. Payments due to go out on Wednesday will be canceled, the administration...