In the past, even perhaps, today, goat herds and sheep herders knew well the ideal herbagesgreen pastures on top of hills and in the valleys around villages, they used to call the flock of sheep or goat to gather. By way of echoes the valley transmitted the sound of the herder, and his flock would hear it and come to him. Hence, old men of the villages in N Lebanon say that "mountains and valleys have ears" since they transmit the sounds by way of echo. That what they believe only.
About "walls have ears": Lebanese famous author Anis Freyha, said that the source of the saying: "walls have ears" derived from Ludovico Ariosto, Italian author and poet who died in 1533 (in Lebanese: الحيطان إلها آذان (walls have ears). I included the translation into Arabic / Lebanese.
الحيطان إلها آذان (أو ذَيْنَين) (أنيس فريحة:1496 ص281) القول "للجدران آذان" هو للشاعر الإيطالي لودوفيكو أريوسطو، أواخر الجيل السادس عشر. (أردني: "الجدار لها آذاني").
Moreover, another idiom: الليل له ذينين (the night has ears) is local, I reckon, and many do believe that during night time a minor conversation can be heard from long distance. Now therefore, silence during night time, would allow us to listen from long distances. Please let me know if that helps. S A Moubarak