The two Nordic countries, which have long avoided joining the alliance, changed their minds abruptly after Moscow’s attack on its neighbor on February 24.