Assuming your train is on time, or not extremely late, then you will have plenty of time.
The Fernbahnhof (long distance train station) at Frankfurt airport is connected via a covered walkway to Terminal 1, which takes about 10 minutes to walk.
(Please note that there are 2 train stations at the airport. You will arrive at the Fernbahnhof, the other regional train station is for local trains)
Allow yourself another 3 - 5 to walk to the Skyline from where you take the Skyline train to terminal 2. Which takes approx. another 5 mins.
Then allow yourself 5 mins to get to the check-in desks.
So altogether 20 minutes is normally enough.
(I assume you have good mobility)
Terminal 2 is smaller than T1 so it does not take so long to pass through the various stages. Although you can still have a long walk!
Please note: If you follow the signs from the Fernbahnhof to Terminal 2 it will send you to take a bus transfer. This can take much longer, as the busses only drive every 10 minutes and often get stuck in traffic, which is worse due to the roadworks. Last October it took me 40 minutes!
So I suggest instead heading into Terminal 1 and then follow signs to Skyline & Terminal 2.