Deuteronomy 24:17-22- Do not deprive the foreigner or the fatherless of justice, or take the cloak of the widow as a pledge. Remember that you were slaves in Egypt and the Lord your God redeemed you from there. That is why I command you to do this.
First, you have to understand how God valued orphan care from the foundations of his people. He states other commands and curses for neglecting the widow, foreigner, and orphan over 13 times in the law and 40 times in the Old Testament. The Prophets condemn the people for neglecting the fatherless. This act of caring was to be an identifying component to the life of the Jewish people.
His law gave instructions to how this was to be done through the systems of tithes and generosity. God also gave his people warnings and curses, it was not a casual request; it was a mandate. But it seemed to be bigger than just dealing with the symptoms of fatherlessness or poverty. The best stories in the Bible present this generosity toward the widow, foreigner, or orphan through discipleship or true investment. Think of the storys of Ruth, or Esther.
In Job 31:17-18 Job explains that he has cared for the fatherless as he would his own children. He saw the care extending past the financial obligations of the law and became a father to the fatherless.
I know we tend to ignore statements from the law as outdated or legalistic. Jesus did come to fulfill the law, but I believe this goes beyond the Law to the heart of God. In Psalms 68, David identifies God as a father to the fatherless; he goes on to say God sets the lonely in families. God wants his people to reflect his character to the world; it is just one more way to shine the light.
I believe that God in his foreknowledge saw the reality of the orphan problem. He knew that they would be impoverished and easily taken advantage of; he knew that the poor would always be with us. But he also knew, it was an opportunity for his followers to impact the world one life at a time.