Ukraine borders Slovakia in the far South-West corner of the country connected with only one border that is usually used by travelers.
You can get from Slovakia to Ukraine and back with train, buses or provate car.
Direct Bratislava-Moscow train leaves Bratislava at 13:57 and Kosice at 20:40 arriving to Lviv at 10:30 and to Kyiv at 20:02.
Reverse it departs from Kyiv at 11:07, from Lviv at 21:20, stopijng in Kosice at 07:31 and arriving to Bratislava at 14:03.
Approx costs are: Lviv-Kosice 560 UAH (50 EUR), Lviv-Bratislava 930 UAH (84 EUR), Kyiv-Kosice 715 UAH (65 EUR), Kyiv-Bratislava 1080 UAH (98 EUR). Very expensive…
There is another option.
Vysne Nemecke-Uzhorod crossing point is used only by cars or buses connecting Transcarpathian region capital city Uzhgorod and village Vysne Nemecke on Slovakian side.
It is probably wise to take this border only in case you’re in Eastern Slovakia or you specially want to visit Transcarpatian region of Ukraine. Otherwise, if you’re in Bratislava or around I think it’s more comfortable to go via Budapest, and for sure from Northern Slovakia around Higth Tatras more convenient way to Ukraine is through Poland.
Slovakian city of Kosice which is situated 100 km East of Ukrainian border is the best starting point towards Ukraine. There are 3 daily buses from Kosice to Uzgorod and return.
From Kosice they depart approx. at 06:00, 07:30 and 12:30 arriving to Uzgorod at 10:30, 12:00 and 17:00. Delays are possible 🙁
From Uzhgorod buses depart at 07:40, 08:20 and 15:30 arriving approx. at 10:30, 12:00 and 17:00. And the same, nobody is secured from border delays.
As an alternative travelling from Slovakia to Ukraine you can go to smaller town Michalovce 35 km West of Ukrainian border which stands on Kosice-Uzhgorod route and catch more buses from there, however bigger city is always more reliable.
Uzhgorod itself is well connected with trains with the rest of the country but it will take way more than 10 hours to get anywhere further than Western Ukraine, so keep it in mind while planning your trip.