6 Then Joshua rent his clothes, and fell to the earth upon his face before the ark of the Lord until the evening, he and the elders of Israel; and they put dust upon their heads. 7 And Joshua said, “Alas, O Lord God, … (Joshua 7:6-7a)
I don’t recall a command from God to do it but Joshua and David (in Psalm 5) themselves seem to have prayed toward the ark of the covenant or the temple, i.e., the portable meeting tent that housed the ark from the time of Moses to the time of Solomon’s Temple, even before Solomon mentioned the practice in 1 Kings 8:22-53 in reference to the temple he built.
DISCLAIMER: Catholic Answers has turned over the archive to Catholic-Questions.org and no longer owns, manages, or moderates the forums. For additional apologetics resources please visit www.catholic.com.