Pickling began 4000 years ago using cucumbers native to India.
This was used as a way to preserve food for out-of-season use and for long journeys, especially by sea. Salt pork and salt beef were common staples for sailors before the days of steam engines. Although the process was invented to preserve foods, pickles are also made and eaten because people enjoy the resulting flavors.
Pickling is the process of preserving or expanding the lifespan of food by either anaerobic fermentation in brine or immersion in vinegar.
The resulting food is called a pickle, or, to prevent ambiguity, prefaced with the adjective pickled. The pickling procedure will typically affect the food’s texture and flavor.
Pickling can preserve perishable foods for months.
Antimicrobial herbs and spices, such as mustard seed, garlic, cinnamon or cloves, are often added. If the food contains sufficient moisture, a pickling brine may be produced simply by adding dry salt. For example, German sauerkraut and Korean kimchi are produced by salting the vegetables to draw out excess water. Natural fermentation at room temperature, by lactic acid bacteria, produces the required acidity. Other pickles are made by placing vegetables in vinegar. Unlike the canning process, pickling (which includes fermentation) does not require that the food be completely sterile before it is sealed.
Source: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC154497/, Wikipedia