Abraham was righteous before being circumcised because He believed the Lord - He had faith.

Circumcision was simply a physical confirmation of being in agreement with the covenant - a seal of righteousness by faith.