The Sword Ban has been enforced after arrival of the Amanto. But is that Ban enforced in the whole universe or can the Samurais use the Swords on other planets? There has not been any seen use of Swords on other planets but neither there has been any declaration that the Swords cannot be used in the whole universe.
I think the real reason is that Sorachi-sensei actually forget about it. Hell, he even forget about Shinpachi and Otae's goal of restoring their family dojo.
But, here is the interesting thing. After loads of episodes where Shinpachi and Otae's goal was forgotten, a new character named Hajime who was supposed to be Otae and Shinpachi's senpai at the dojo returned to Earth.
This Hajime returned to Earth after travelling to universe to learn various sword techniques and challenged sword masters around the universe. By this, we can safely assume that the sword ban was enacted only on Earth. As to whether it was enacted all around the Earth or just Japan we can't say for sure since Gin-san and friends never left Japan's mainland.