In the King James Version of the Bible, Matthew 6:7 reads: "When ye pray, use not vain repetitions, as the heathen do: for they think that they shall be heard for their much speaking."
The word vain means "empty" or "useless"; so Jesus is warning us that repeating worthless phrases in our prayers will not help them be heard by God.
Various other translations have similar phrasing such as:
"Do not use meaningless repetition" (NASB),
"Do not heap up empty phrases" (ESV), or
"Do not keep on babbling" (NIV).
This has led various Christian believers to conclude that Jesus is telling us that the use of repetitious words or formulaic phrases is a "heathen" or "pagan" practice and should not be part of Christian prayer.
There is an important concept in Bible study: Text without a Context is a Pretext. Think of it this way, regarding only one verse is a misleading practice.
Any verse in scripture must be studied in harmony with the whole of scripture. At a minimum, at least look at the verse or two prior and after to look for clues. Further, study of the culture and background is required. Words have meaning in the culture that they originated in that may be very different from the culture of the reader.
In the case of our example, let's start by taking a look at Matthew 6:5-8 in the RSVCE.
5 "When you pray, do not be like the hypocrites, who love to stand and pray in the synagogues and on street corners so that others may see them. Amen, I say to you, they have received their reward. 6 But when you pray, go to your inner room, close the door, and pray to your Father in secret. And your Father who sees in secret will repay you. 7 In praying, do not babble like the pagans, who think that they will be heard because of their many words. 8 Do not be like them. Your Father knows what you need before you ask him.
Jesus strongly makes a comparison to the prayer of the hypocrites, then moves on to the privacy and personal nature of prayer, and admonishes us to not pray for the appearance we give to those around us. Then he makes comparison to the prayer of the pagans. Notice here, as in the NIV and ESV translations, the words used aren't vain, nor repetition. Instead words like empty phrases or babbling are used.
In the RSVCE version the instruction "do not babble like the pagans, who think that they will be heard because of their many words" has a very different meaning.
Next, let's take a look at the culture. The pagans that Jesus is referring to believed in many gods who were petty, vindictive and jealous. One of the prayer goals of the pagans was to appease their gods. They prayed, not with the intention of pleasing or worshiping their gods, but rather in order to placate them. One goal was to wear them down. Further, with many gods, they had to satisfy them all. Morning prayer, for example, might consist of mentioning all the gods ensuring that none were overlooked. The ultimate goal was to get through the list of prayers, saying enough words directed to each god, so that they could get the gods temporarily satisfied, so that they could move on with their day. The words themselves didn't necessarily matter, as long as they said enough of them. That sounds like a very good description of babbling.
I've known many very good Christian men and women who spend considerable time praying with many words. I've heard pre-meal prayers that went on for a long time praising God for the sky and the trees and the beautiful weather, and the gathering of people present at the meal, and good health and fortune and the love of family and friendship and… Well, you get the idea. Some may consider this babbling.
Likewise I know other Christians that pray out loud, leading prayer in a group setting, that like to spend several minutes, meditation like, saying phrases of praise to God as they pop into their head. Sometimes sounding very random, or flitting around from topic to topic. Some may consider that to be babbling too.
Are these types of Christian prayer forbidden by Jesus? After all, they are very babbling in nature. I should think that they are not forbidden. These prayers that could be disliked by some could be very uplifting to others.
In these cases, I think the operative word is meaningless. In both of these examples, the prayers are full of meaning. Just as the Rosary is full of meaning.
Next let's take another look at the word repetition. According to some Christian beliefs, God hates repetition. He would much prefer a short, simple prayer than a repetitive prayer. If that's the case, then the book of Revelation contains an error.
Revelation 4:8 reads: The four living creatures, each of them with six wings, were covered with eyes inside and out. Day and night they do not stop exclaiming:
"Holy, holy, holy is the Lord God almighty, who was, and who is, and who is to come."
In this example, scripture shows that God doesn't have a problem with repetition.
So we can conclude that Matthew 6:7 doesn't have anything to do with meaningful Christian prayers like the Rosary.