You can take the train, though it won't be direct or terribly quick - count on changing trains a couple of times - probably in Vienna and somewhere else as well. You can get an idea of train schedules, connections and length of journeys by checking the German website, www.diebahn.de
. You can get the info in English, so no worries if your German isn't up to snuff.
Flying would be a lot quicker, and probably fairly easy between Rome and Prague, though there may be other cheap(er) cities from which to fly, so it's worth looking at the different options. If you wanted to stop off and see stuff en route, train would definitely be the way to go, but if you want to maximize your time in each city, opt to fly.