First of all, it's not a long trip and you don't need to break it. If you take a direct train from Kraków to Ostrava, then the train doesn't stop in any interesting places. Alternatively, you can take a connection through Katowice and chances are you'll like the city, since it's very similar in many aspects to Ostrava, where you're heading.
I have a different suggestion for your trip.
You can stay for a night or two in Cieszyn, it is a border town and very nice and worth visiting.
From Krakow take a bus from bus station adjacent to train station and in 2.5 hrs you are in Cieszyn.
You can then cross the border into Czechia - (Czesky Tesin) and walk to their train station for a train to Ostrava.
It is only about 500 metres from the border bridge to station. There is a lots of trains from there.
Enjoy your trip.