It is an allusion to a practice of the Jews. When some of them went up to Jerusalem, their way lay through the valley of Baca, which was a very dry valley, where no houses were, where no water was for their relief and refreshment; whereupon they dug pits, and as the rain fell and they were refreshed, they got strength and went on to Jerusalem, where they saw the Lord in His ordinances. So says the Psalmist, "Blessed are they in whose heart the law of God is." There is a generation of men in the world that have the law of God in their hearts, though they cannot act and work towards God as they would. These are sometimes in a dry or barren condition where no water or comfort is, yet if in this condition they dig wells, go to prayer, wait upon God in duty though they find no comfort springing up in their duty for the present, yet in due time the rain of God's blessing will fill those dry wells and empty duties, whereby their life shall be like unto a pool of water, and they shall go from strength of grace, to strength of grace, until they see the Lord. Know ye, therefore, any man that is in this valley of Baca, where no water is, yet if he can find it in his heart to dig wells, pray, read, hear, meditate, confer, and perform duties, thought these duties should be empty of comfort for the present, yet the rain of grace and mercy shall fall upon these wells, and he shall go from strength to strength till he appear before the Lord in glory."
~ A Lifting Up For The Downcast by William Bridge