There is a discussion about this passage in the Babylonian Talmud (B. Nedarim 32a), in which the rabbis say that Abraham "was seized with trembling" when he heard this command. Abraham's heart sank with guilt as he imagined that he must carry some terrible sin and stain within him that caused God to demand that he become pure. However, when Abraham then heard God say, "And I will make my covenant with you," his heart was filled with joy in the realization that perfection was, somehow, within his reach.
Perfection, you see, does not mean being without flaws, as Abraham first imagined. Rather, it means that we are willing to admit our flaws and to allow God to perfect them.
This is how the rabbis understand the ritual of circumcision. How, you might ask, is a man made better by permanently marking his flesh? Wouldn't the cutting of circumcision make him less perfect, less in the form that God intended for him? The rabbis answer this by saying that circumcision helps bring a man closer to perfection specifically because it points out flaws and acknowledges imperfection. If we were to depend only on our flawed selves to repair ourselves, we would be hopelessly and endlessly disappointed. It is only when we recognize that there is something beyond ourselves to which we owe reverence and hope for healing that we can find our highest selves. We can, by submitting ourselves to God, find a different kind of perfection.
In the same section of the Talmud, Rabbi Yitzchak says, “When you seek to conduct yourself perfectly, the Holy Blessed One deals perfectly with you." We human beings do not reach perfection, but we can do something even better: we can strive for perfection. The fact that we fail—again and again—does not diminish the merit we earn in trying. God sees our striving and treats us as if we were perfect. God perfects us, and this is why Abraham rejoiced.