First, they satisfied the domestic need for immediate action. There was no way the Iranians could promise covert or proxy action as a response to the killing of someone as prominent as Soleimani. They had to demonstrate to loyal citizens that they would act, and to dissident citizens that they did not fear the Americans. The United States directed the killing of Soleimani, and so the missile strikes were directly and publicly attributable to Iran—as the Iranian regime intended them to be.
Second, Iran showed that it was willing to roll with changes in the rules of the game. As Leon Panetta said on Meet the Press the day after the Iranian strikes, the Obama administration never considered taking out Soleimani, because the risk of war simply wasn’t worth it. Likewise, Iran had avoided the use of ballistic missiles against any other state since the Iran-Iraq War. The Americans showed that they were willing to kill senior Iranians. The Iranians showed in return that they were willing to use ballistic missiles, and that next time they might not be targeted to miss.
Third, the strikes were a signal to Iraq, and to other nations in the region, that association with the Americans does not confer some magical immunity. Indeed, they demonstrated that allying with the U.S. is a risk in itself.