John, along with the other Apostles, had been taught by Christ that the pure of heart shall see God (Matthew 5:8). Cyprian of Carthage (200-250 AD) explains what this means in the context of another of John's Epistles:
In the Epistle of John: If our heart blame us not, we have confidence
towards God; and whatever we ask, we shall receive from Him. (1 John
2:21-22). Also in the Gospel according to Matthew: Blessed are they
of a pure heart, for they shall see God. Also in the twenty-third
Psalm [LXX]: Who shall ascend into the hill of the Lord or who shall
stand in His holy place? The innocent in hands and of a pure heart.
Third Book of Testimonies Against the Jews (Treatise XII), No.
79
John is not writing here, however, of cause and effect - i.e. if you do good, you will see God; else not - but rather of consequence. If one is doing good, it is because he or she is in communion with God; in which case one would certainly perceive, or "see" God.
We can consider here the commentary of Justin Popovic, a 20th century Orthodox Christian theologian, on this specific verse:
Behind every good stands the Good One, the All-Good One. He gives
powers to man and awakens man to do good. If a man doeth good, it
is a sign that he has united himself with the Only Good One, with God,
that he has united himself with God to such an extent that all the
spiritual powers in him are born of of God, and emanate from God.
There is no good in man that is not from God; and likewise, there is
not an evil in man that is not from the devil. As a result of
sinning, a black fog arises in the soul, which clouds God's presence
in man's spiritual sight. Then man does not see God, neither in
himself nor above him, neither in the world nor above the world. He
that doeth evil does it because he is always, consciously or
unconsciously, in a spiritual bond with the creator of evil.
Committing evil blinds man.
Commentary on the Epistles of St. John the Theologian (tr. from
the Serbian, Sebastian Press, 2009), pp.92-93