You will need to upgrade one version at a time, starting from your current 1.24 → 2.0 → 2.1 and so on, until you are on a current version.
You can find the (old) upgrade documentation for Katello hosts at Foreman :: Plugin documentation index (pre Katello 3.17 versions are under “older releases”). Once you are at Katello 3.18, all the documentation can be found at docs.theforeman.org. There select the version for each upgrade (starting with 4.0) and use the upgrade docs there.
Note that somewhere between Foreman 3.1 and 3.3 (Katello 4.3 to 4.5), you will need to upgrade to EL8.
Depending on your setup (which additional plugiins you have installed, the general “health” of your system, …) you might encounter some additional pitfalls along the way.
Friendly reminder to always have a full machine backup at hand when doing upgrades or at least taking a snapshot beforehand.
Considering how many upgrades you’ll have to do, and that you will need to do the EL7 → EL8 migration on top somewhere in between, you might want to consider building a new, current stack from scratch and migrating everything over. Depending how large your environment is and how much data (CVs, Puppet ENC variables, etc) your Foreman holds, that might be the easier and faster route to take, but only you can decide what’s easier for you to do.