Visby is the only town at the island of Gotland (Sweden).
Way by the sea to Visby on the daily ferry from Nynäshamn is most comfortably. You need to get the train from Stockholm to Nynäshamn (~40 min) and the ferry (~3 hours) run 2 times a day. But this is not the only one way to Visby. There is a ferryline from Oscarshamn too, but
ferries run less frequently and a little longer. Also there is an air traffic Stockholm - Visby and it is could be not a bad choice considering that the ferry prices are quite high.