KABUL — Islamic State militants stormed Afghanistan’s main military hospital, now housing injured Taliban fighters and veterans of the former Afghan military, and killed at least 23 people in the latest eruption of violence since the country’s U.S.-backed government collapsed in mid-August.