Praise be to Allaah.
Vinegar is a well known basic foodstuff, made from wine of which the composition has changed so that it is no longer sweet but is acidic or sour.
Jaabir (may Allaah be pleased with him) reported that the Prophet (peace and blessings of Allaah be upon him) said: “What a good food is vinegar.” (Reported by Muslim, 3/1623)
When wine turns to vinegar by itself, without any deliberate treatment needed for it to be changed, it is permissible to eat, drink and handle it, according to the consensus of the scholars, because of the hadeeth quoted above.
But if the wine has become vinegar because of deliberate treatment, by adding vinegar, onions, salt etc., or by any other process, in this case the scholars (may Allaah have mercy on them) differ as to whether it is permissible.
The Shafi’is, Hanbalis and some of the Maalikis say that it is not permissible to deliberately change wine to vinegar because then it is not pure. The evidence (daleel) for this is the hadeeth of Anas ibn Maalik (may Allaah be pleased with him) who said: “The Messenger of Allaah (peace and blessings of Allaah be upon him) was asked whether wine could be changed to be used as vinegar. He said, ‘No.’” (Reported by Muslim).
Abu Talhah (may Allaah be pleased with him) reported that the Prophet (peace and blessings of Allaah be upon him) was asked about some orphans who had inherited some wine. He said, “Pour it away.” He was asked, “Could they not make it into vinegar?” He said, “No.” (Reported by Muslim).
The reason for this is:
Allaah, may He be glorified and exalted, has commanded us to avoid wine. Keeping it and treating it until it turns into vinegar means handling it and being involved with it by storing it and benefitting from it, and this is not permitted.
It is permitted for a Muslim to buy vinegar from someone who is selling it, unless he realizes or comes to know that it was produced by means of a deliberate process. ‘Umar (may Allaah be pleased with him) said: “… There is nothing wrong with a man buying vinegar from the people of the Book, if they sell it, so long as he knows that they did not deliberately process it from wine.” (Al-Mughni, 8/330)
And Allaah knows best.
(Bidaayat al-Mujtahid li Ibn Rushd, 1/461; Kashshaaf al-Qinaa’ li’l-Bahwati, 1/187; Fath al-Qadeer li Ibn al-Hammaam, 8/166; al-Majmoo’ li’l-Nawawi, 1/225; al-Mughni li Ibn Qudaamah, 8/319).