Vinegar, containing mild acetic acid, increases the acidity in the cucumbers and eliminates any potentially harmful microorganisms in the jars. This helps in preserving the cucumbers and preventing spoilage.