There are several references in the New Testament to public prayers that are unacceptable, and it is true that Jesus condemned the Pharisees’ manner of praying. But Jesus Himself prayed out loud on occasion (see John 17), as did the apostles (Acts 8:15; 16:25; 20:36). Acts 1:14 says, "They all joined together constantly in prayer, along with the women and Mary the mother of Jesus, and with his brothers." Then in verse 24, the apostles prayed together to choose someone to fill Judas' spot among the twelve. They were clearly praying together and out loud. So, the sin was not in the public nature of the prayer or the fact that people could hear it.
In Luke 18:10-14, Jesus gives this parable: “Two men went up to the temple to pray, one a Pharisee and the other a tax collector. The Pharisee stood by himself and prayed: ‘God, I thank you that I am not like other people—robbers, evildoers, adulterers—or even like this tax collector. I fast twice a week and give a tenth of all I get.’ But the tax collector stood at a distance. He would not even look up to heaven, but beat his breast and said, ‘God, have mercy on me, a sinner.’ I tell you that this man, rather than the other, went home justified before God. For all those who exalt themselves will be humbled, and those who humble themselves will be exalted.” Notice that the tax collector also prayed aloud, but his prayer was from a humble heart, and God accepted it. The sin of the Pharisees was not public prayer but a haughty spirit.
Later, Jesus says, "Beware of the scribes, who like to walk around in long robes, and love greetings in the marketplaces and the best seats in the synagogues and the places of honor at feasts, who devour widows’ houses and for a pretense make long prayers. They will receive the greater condemnation" (Luke 20:46-47). Here the sin is not the audible nature of the prayer but its pretentiousness. Jesus condemns the hypocrisy of pretending to have a relationship with God while oppressing the very people He loves.
Then in Matthew 6:5, Jesus says, "And when you pray, do not be like the hypocrites, for they love to pray standing in the synagogues and on the street corners to be seen by men. I tell you the truth, they have received their reward in full." Again, Jesus is not condemning the fact that people prayed aloud, but that they were putting on a public display for their own benefit. Their motive—to be seen of men—was the problem. Such prayer is not real prayer, but empty words meant for the ears of other people (Hebrews 10:22). Proverbs 15:29 says, "The LORD is far from the wicked but he hears the prayer of the righteous."
In Ephesians 5:20, Paul instructs the church to "give thanks always and for everything to God the Father in the name of our Lord Jesus Christ." Communal prayer is one way a local church worships God and encourages one another. What Jesus condemns is arrogance and hypocrisy. For someone who is clearly disobedient to God to lead a public prayer as though he or she had much to brag about is the kind of hypocrisy that Jesus denounced. To use public prayer as a means of showing off or impressing others is wrong. But sincere prayer from a humble heart is always welcomed by God and can be an encouragement to those who hear it (Psalm 51:17).