You can ask this about a lot of foods, but probably won't get many satisfying answers. For example cheese goes back many thousands of years, and it's theorized that it was invented accidentally due to storing milk in sheep stomachs or similar.
Probably something similar for pickling. Someone noticed that salted foods last a long time, and vinegar never seems to go bad, so why not try combining them?