The historic shift comes after more than 200 years of military nonalignment in the Nordic country, in the wake of Russia’s invasion of Ukraine.