It was narrated that Ibn 'Abbas said:
Concerning the saying of Allah, the Mighty and Sublime: And offer your salah (prayer) neither aloud nor in a low voice - It was revealed when the Messenger of Allah (ﷺ) was still (preaching) in secret in Makkah. When he led his companions in prayer, he would raise his voice -(One of the narrators) Ibn Mani' said: He would recite the Quran out loud - And when the idolators heard his voice they would insult the Quran, and the One Who revealed it, and the one who brought it. So Allah, the Mighty and Sublime, said to His Prophet (ﷺ): And offer your salah (prayer) neither aloud that is, such that the idolators can hear your recitation and insult the Quran; nor in a low voice, so that your companions cannot hear; but follow a way between.