The U.S. military struck three sites in Iran, inserting itself into Israel’s war aimed at destroying the country’s nuclear program in a risky gambit to weaken a longtime foe amid Tehran’s threat of reprisals that could spark a wider regional conflict.