John uses darkness and light as metaphors for how to live life in fellowship with God. Because God is light, those in fellowship with him will walk in the light (1:5). The metaphor of darkness and light is common in Second Temple Judaism.
Paul also used a similar metaphor in 1 Thessalonians 5:5. The Christian is a child of light and the day, the ones who are awake. The wicked are the ones who belong to the darkness or the night, the ones who are asleep. Possibly Paul had Matthew 25 in mind, the parable of the Ten Virgins (some are in the light of the wedding banquet, others are outside in the darkness).
The primary background for John’s light and dark metaphor is the Gospel of John. Jesus himself is the light of the world (John 8:12; 9:5) who reveals the light of the glory of God (John 1:4, 14, 16). In John 12:35-36 Jesus commands his disciples to walk in the light before the darkness overtakes them because they are children of light. John states God himself is light and there is no darkness in him. John’s point is not to equate God with literal light, but to the fact that human virtue and righteousness are defined by the character of God, it is God defines moral standards.
To be in fellowship with God requires we walk in the light (1:6). This is the first of three conditional sentences in this section: If we make the claim to have fellowship with God but are not walking in the light. It is likely these three conditional sentences are claims the opponents have made. They went out from John’s community and claimed they still had fellowship with God. But they are walking in darkness, so they cannot be in fellowship with God. A third class conditional sentence may not reflect actual reality. The syntax as the sense of “If we say this (and I am not claiming you are in fact saying this), then this is the case.” Karen Jobes says “There is an implicit uncertainty as to who is saying these things.” The grammar might be understood as “if anyone of us claims to have fellowship with God but walk in the darkness…” (1, 2, & 3 John, 65; citing Wallace, GGBB, 698).
To “walk” is a common way in the Old Testament for expressing how a person lived their life, so “Enoch walked with God” (Gen 5:24) means something like, “Enoch lived a righteous life.” In later wisdom literature there were “two ways” a person could walk, one that led to life and another than led to death.
Unfortunately, “What it actually means to ‘walk in the light’ and to ‘walk in the darkness’ is not explained in this letter.” I would suggest (based on the rest of the letter) that there is some doctrinal component to walking in the light, believing the right things about Jesus. But there is a clear ethical component as well, the one walking in the light (as Jesus is in the light) are living out their faith in a way that is pleasing and acceptable to God.
How we unpack those two areas are important: how much doctrinal agreement is necessary to have fellowship? The Apostle’s Creed? The Nicene Creed? Even then, do we need to all agree on how each line is understood? (I believe in the Holy Spirit is extremely vague!) The Evangelical Theological Society doctrinal statement is only two points (Trinity and Inerrancy). My own church has fourteen points in their doctrinal statement. Or do we need to agree with a detailed document like the Westminster Confession or the Augsburg Confession to ensure doctrinal fidelity?
The same can be said for ethical and moral “walking in the light.” What are the community rules we are all willing to accept and demand of each other, and what are the non-essentials we are willing to compromise on? Older Christians might have argued about going to the movies or use of alcohol, but there are much more difficult issues to be discussed in the present church, such as sexual choices and how Christians should (or should not) react to them, The church ought to have something to say about treatment of the poor and the immigrant from a biblical perspective (rather than a political position).
So walking in the light is much more difficult than “keep the Ten Commandments” or “be kind to people.” Those are good things, but the one who is walking in the light ought to shine that light into the darkness of this world in order to bring the Gospel to bear on more than just a few key doctrines or practices.