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](https://www.gatwickairport.com/at-the-airport/passenger-services/Changing-terminals/) 24 hours a day.

The shuttle they refer to is the _landside_ peoplemover between North and South terminal.

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.