The feast day of Our Lady of the Rosary was instituted by St. Pius V in commemoration of the victory of the Battle of Lepanto on October 7, 1571 against the Turks who were threatening Europe. In 1716, the feast was extended to the entire Church in thanksgiving for the defeat of the Muslim Crescent in Hungary.
Apart from the signal defeat of the Albigensian heretics at the battle of Muret, in 1213, which has been attributed to the recitation of the Rosary by St. Dominic, it is believed that Heaven has, on many occasions, rewarded the faith of those who had recourse to this devotion in times of special danger. More particularly, the naval victory of Lepanto, gained by Don John of Austria, over the Turkish fleet on the first Sunday of October in 1571, responded wonderfully to the processions made at Rome on that same day by the members of the Rosary confraternity.
We know that the victory of the Battle of Lepanto was achieved when St. Pius V interrupted a meeting with Cardinals at the Vatican and went to a window and started to pray the Rosary. He was deeply concerned about the future of the Church and Christendom that was being decided in those Mediterranean waters. After the Pontiff finished praying the Rosary, he returned to the meeting and told the Cardinals that the Catholic fleet had been victorious. That is, he had a revelation while he was praying the Rosary. It was the way Our Lady showed him that she linked that victory to his praying of the Rosary. Understanding this, St. Pius V instituted the feast of Our Lady of the Rosary, which was extended to the whole Church in commemoration for another great victory over the Mohammedans in 1716.
St. Pius V thereupon ordered that a commemoration of the Rosary should be made upon that day, and at the request of the Dominican Order Gregory XIII in 1573 allowed this feast to be kept in all churches which possessed an altar dedicated to the Holy Rosary.