The Verdict: Need More Info
If you are a Commonwealth citizen, or a Nepali citizen joining the Brigade of Gurkhas, you can apply to enlist, and four years' service leads to settlement and then citizenship. Check your nationality is eligible, then approach recruitment knowing this is a career, not a visa.
From enlistment you are exempt from immigration control. After four years' reckonable service you can apply for indefinite leave, and twelve months later for citizenship: about six years in all, with no sponsor or salary threshold.
Recruitment has medical, fitness and security standards and is competitive; some roles also require a period of UK residence. Being eligible to apply is not being accepted.
Irish citizens can enlist too, but are already settled in the UK and do not need this route.
Leaving before four years, for any reason, ends the exemption without the settlement route. A child born in the UK becomes entitled to register if a parent joins while the child is under 18.