The same happens in Germany (tschau), Spain (chao) and in many other countries like Bulgaria (pronunced 'ciao') or the Czech Republic (au). In the English language, it was Ernest Hemingway who first introduced the greeting in his book Farewell to Arms in 1929, a novel set in north-east Italy.
The expression was derived from the Venetian dialect sciao, which has since diffused across Italy and, thanks to Italian immigration and a fascination with the Italian way of life, across the entire world. Sciao (pronunced 's-ciao') is derived from the latin sclavus. It initially meant 'I am your slave'; 'I am at your service.'
'Ciao' still corresponds to the Latin servus, which is still used widely today in Bavaria and Austria, just like the Italian 'ciao' is used to say hello and goodbye. In days gone past, servus was used by the elderly in Poland. Instead of the language of Kapucinski, they seem impermeable to foreign influences in this case. The Poles are the rare exceptions in Europe who allegedly never use the popular greeting sciao. Eh ciò - Oh well - the Venetians would sigh. Today they use the original 'sciao', but only to express resignation.