This phrase was originally used as a farewell, expressing the wish that God would be with the person departing. Over time, it evolved into the more general term of farewell we use today.
So, the next time you say "adieu," remember you're wishing someone "to God" in the original sense!