The concept of a national army only really emerges after the French Revolution and the constitution of the Levé en Masse. Prior to that, most professional armies recruited whomever was willing to join. Switzerland, a confederation of poor mountainous communities populated by rugged men who knew how to fight, was a prime recruiting ground for Italian and French rulers, including the Pope.
The Pope's personal guards were primarily but not exclusively Swiss until the 1920s; by then the Papal States had been annexed by Italy and the corps had ceased to serve any function at all, so they were reformed into the ceremonial guards you are familiar with today with historical arms and uniforms. The "Noble Guards," the Papal States' former elite cavalry, and the "Palatine Guards," the former Gendarmerie, were also reformed into ceremonial units with historic uniforms until they were disbanded in 1970. The regular Papal army, such as it was, had been disbanded after the fall of Rome at the hands of the Italian Army in 1870.
Since the Lateran Treaty with the Italian Government in 1929, police duties in the Vatican City have been performed by the Vatican Gendarmerie Forces, however the Swiss Guards are all recruited from existing servicemen in the Swiss army, and perform personal protection duties with small arms in plainclothes in addition to their ceremonial role.
While waiting for a potential response, a quick search on Askhistorians yields a variety of results, some of which touch on your question.
https://www.reddit.com/r/askhistorians/search?q=Swiss%20guard