Kastoria has a small airport (Aristotelis Airport) with domestic connections to Athens. Olympic Air and Sky Express operate flights that take around an hour; schedules are limited, so check ahead.
By road from Thessaloniki, Kastoria is about 200km west through the Macedonian mountains — roughly two and a half hours on mostly good roads. There are regular bus connections from Thessaloniki's main bus terminal. From Athens, the journey is around five and a half hours by bus or six hours by road. The mountain scenery on the approach from any direction is worth staying awake for.
There is no train to Kastoria.