I found this source on Swiss Data Protection Laws. The most relevant bit appears to be in Section 8.1
How do employee data protection rights affect the employment relationship? Can an employer transfer employee data freely to other countries?
The employer may handle data concerning the employee only to the extent that such data concerns the employee's suitability for his or her job or is necessary for the performance of the employment contract. Such data must have a close connection to the employment, and any gathering of data must be strictly proportionate to its purpose.
This is strictly in relation to international affairs, but would not support sharing salary information.
I also found this
Must employers publish information on pay or other details about employees or the general workforce?
In general, employers are not obliged to publish any information on their employees.
Swiss companies listed on a stock exchange must publish an annual remuneration report. The remuneration report must disclose any compensation that the company paid directly or indirectly to current members of the board of directors, the executive management and the advisory board, and to former members of the board of directors, executive management and advisory board to the extent such compensation is related to the past activity as a corporate body of the company or to the extent such compensation is not customary market practice; post-retirement benefits need not be disclosed.
The information regarding compensation must include:
the aggregate amount paid to the board of directors and the individual amount paid to each member, specifying the name and function of the member concerned;
the aggregate amount paid to the executive management and the highest amount paid to an individual member, specifying the name and function of the member concerned;
the aggregate amount paid to the advisory board and the amount paid to each member, specifying the name and function of the member concerned; and
if any, the aggregate supplementary compensation amount (according to the company’s articles of association) paid to the executive management and the amount paid to each member, specifying the name and function of the member concerned.
This only states that employers are not obliged to publish information about their employees (barring the annual remuneration report). That being said-- "not obliged to" and "explicitly illegal to" are not the same thing. Most likely, for a Swiss company speaking to another Swiss company, they would be within their rights to disclose your previous salary if they wished to.
All of that being said-- the majority of companies don't really care to dig into your file too awful deep. If someone calls up and asks, "Did so and so work here from date A to date B?" the company is legally obligated to confirm or deny that statement. They aren't legally obligated to provide any additional information unless the police are inquiring, and most people are lazy-- they don't want to do anything more than what is required of them to keep their jobs. This external company isn't paying them, so why waste time and energy answering questions you don't have to? Unless company policy is weird, or you left a really bad taste in someone's mouth at the offices of your former employer, I think it would be unlikely that your former employer would bother to look up and share your salary information.
Disclaimer: I am not Swiss, and all of my knowledge is based on googling English-language sources. I cannot compare my answer against any sources in French or German.