It depends on how you translate pedo. The Sindarin word means both 'speak' and 'say', depending on context. The gag in the story is that Gandalf slightly mistranslates, and then spends hours trying to come up with the password implied by 'speak', when the password - 'friend' - was right there on the inscription.
Why have a password in the first place and then publish it in stone? "More trusting times" says Gandalf. Tolkien wants to make a little linguistic joke, says I - or possibly the Elves believed that evil races confronted by the closed doors could never bring themselves to pronounce an Elvish word...
Interestingly, the Quenya root for 'speak, say' is quet-. Thus the root word for the race of Elves, the Quendi, means the 'speaking ones', and Quenya itself means 'the speech' or 'the language' and Quenta Silmarillion means 'Tale of the Silmarils'.
Sindarin differs from Quenya due to a large number of sound-changes, such as occur in any language over time. Tolkien wanted to explore how two imaginary languages could be accurately related along those longitudinal lines (over time, like Latin becoming Italian) rather than through latitudinal dispersion (like the cousin languages Spanish and Italian). This drove his story of the Elves: those who were left behind in changeable, mortal Middle-earth developed Sindarin from the common language they had all shared in the beginning, while those who went on over the Sea to immortal lands maintained the original Quenya. Thus most of the Elvish place names in The Lord of the Rings' Middle-earth are in Sindarin; while the Silmarillion, whose heroes are from Elvenhome but in exile in Middle-earth, is chock full of Quenya. Quenya is called the ancient and little-used "High Elvish" in the Lord of the Rings.
Right. So one of these sound changes is that qu- in Quenya becomes p- (or b-) in Sindarin. Thus the derivation of ped- as the root for pedo - it's the same word as the Quenya quet-. (all this from the handy-dandy Quenya dictionary in the back of the Silmarillion).