It does not appear to be possible to transfer airside between terminals at Gatwick. Note that https://www.gatwickairport.com/at-the-airport/flying-in/flight-connections/ says:
If you need to change terminals, you can take our free shuttle 24 hours a day.
The shuttle they refer to is the landside peoplemover between the North and South terminalterminals.
So in order to reach your departure terminal, you need to enter the UK. Depending on your nationality, where you're traveling from, and which other visas you hold, you may qualify for the UK's landside "Transit Without Visa" scheme, but you have not given enough information in your question to determine that. See this question (and links therein) for details.