Did they get changed in Asgard or did they pick up some clothes on Earth? Or was it somehow achieved magically?
It's never explicitly stated but given the way their appearance changes when Hela arrives (and the way Mjolnir appears as an umbrella despite being still clearly Mjolnir in the way it acts) the most likely explanation is that the clothes are in fact an illusion being cast by Loki.
Previously in the MCU when Thor's "outfit" has changed to his full-on "work clothes" (e.g. in The Avengers after his fall from the Helicarrier) we've seen a fairly spectacular "assembling" of them. In Ragnarok they both simultaneously appear to shift into their familiar Asgardian outfits near instantaneously suggesting both were part of the same illusion and that Loki chose to drop it in preparation for the anticipated fight with Hela in Norway.
To me it seemed to be strongly implied it was an illusion. Loki is a trickster and illusions are his thing. He was shown changing his appearance multiple times. If he can change his complete appearance, he can definitely change just his clothes. And why would they go through the effort to change their clothes if Loki can just make it look like they did?