After the Annunciation, when the angel Gabriel appeared to Mary, she traveled to the village of her kinswoman Elizabeth. Elizabeth's words of greeting to her are included in the prayer we now say as the "Hail Mary".
 
Luke 1:41-43, The Magnificat

And when Elizabeth heard the greeting of Mary, the babe leaped in her womb; and Elizabeth was filled with the Holy Spirit and she exclaimed with a loud cry, "Blessed are you among women, and blessed is the fruit of your womb! And why is this granted me, that the Mother of my Lord should come to me?" (See also CCC nos. 495, 2676-2677)

Mary responded to her cousin with the words we now know as the Magnificat, recorded in Luke 1 :46-55:

And Mary said, "My soul magnifies the Lord, and my spirit rejoices in God my Savior, for he has regarded the low estate of his handmaiden.

"For behold, henceforth all generations will call me blessed; for he who is mighty has done great things for me, and holy is his name.

"And his mercy is on those who fear him from generation to generation. He has shown strength with his arm, he has scattered the proud in the imagination of their hearts, he has put down the mighty from their thrones, and exalted those of low degree; he has filled the hungry with good things, and the rich he has sent empty away.

"He has helped his servant Israel, in remembrance of his mercy, as he spoke to our fathers, to Abraham and to his posterity for ever."

Why is the story of the Visitation included in Luke's Gospel and in the Joyful Mysteries of the Rosary? Is it not because it gives us a glimpse into Mary's character and allows us to know her more clearly? She demonstrates kindness and charity toward her cousin by going at once to help Elizabeth prepare for the birth of her long-awaited child. This episode shows us her fearless acceptance of God's mission for her.

These are both good reasons. But the Visitation also presents us with a striking preview of what is to come. In this mystery, we see that Elizabeth, who is pregnant with John the Baptist, the last Messianic prophet, greets and rejoices in the presence of Mary, who carries within her Jesus, the Messiah. The Visitation shows us the Old Testament meeting, being fulfilled by, and giving way to the New Testament.

The earliest record of observance of the feast is by the Franciscans in 1263, recommended to them (perhaps as an example of hospitality?) by Saint Bonaventure.

The feast was extended to the entire Church by Pope Urban VI in 1389, near the end of his papacy. The Pope hoped that the intercession of Christ and His Mother would put an end to what is known as the Great (or Western) Schism. This period, which began with Urban VI's election in 1378, saw turmoil and argument over who of two (later three) men was really the Pope and where he should reside. After forty years—and many Church councils, negotiations, and outright conversion of princes, kings, and one "anti-pope"—peace and unity in the Church were finally restored in 1429, with the worldwide recognition of Clement VIII as Pope, and of Rome as his proper residence.