It will be retroactively illegal and the companies can claim damages from the US government... Kinda? Federal law is now an absolute nightmare with the latest "every district is its own thing" and "unitary executive" and "presidents are immune for official acts" kind of policies.
If SCOTUS does decide tariffs are illegal (which they are, objectively, irrefutably illegal for the POTUS to declare - Congress is explicitly the only branch with this power in the constitution), the US may owe hundreds of billions back to countless organizations and individuals.
But we live in a country without consistent law or a reason-based government, so SCOTUS may just declare that the executive has absolute authority instead.
That feels like semantics at this point. If there is no enforcement on this decision, the American people are still paying the tariffs for almost a year. If SCOTUS upholds them as being illegal next summer, and even if they say people can get reparations, and even if they figure out a way to do so without creating other problems... that doesn't fix the next 10-11 months.