Fellowship with God depends, in part, on fellowship with other believers.
Let me offer two short proofs for the claim, one positive and one negative.
First, the positive proof is that John says that fellowship with the apostolic circle implies fellowship with God:
“that which we have seen and heard we declare to you, that you also may have fellowship with us; and truly our fellowship is with the Father and with His Son Jesus Christ” (1 John 1:3; cf. v 7, “fellowship with one another”).
John has fellowship with the Father and the Son. If you have fellowship with John, then you have fellowship with the Father and the Son, too. The two fellowships go together. On the other hand, if you’re out of fellowship with John, then you’re also out of fellowship with the Father and the Son. That is a reasonable inference from John’s statement.
Second, the negative proof is that fellowship with God depends on walking in the light. If you walk in darkness, you’re out of fellowship:
If we say that we have fellowship with Him, and walk in darkness, we lie and do not practice the truth (1 John 1:6).
If you walk in darkness, that should be reflected in your standing at church. That is, the church is supposed to exercise discipline as part of the Biblical doctrine of separation. If someone is walking in the darkness they should be excommunicated or removed from fellowship, especially from participating in the Lord’s Supper:
You have become arrogant and have not mourned instead, so that the one who had done this deed would be removed from your midst (1 Cor 5:2 NASB).
But now I have written to you not to keep company with anyone named a brother, who is sexually immoral, or covetous, or an idolater, or a reviler, or a drunkard, or an extortioner—not even to eat with such a person (1 Cor 5:11).
Therefore “put away from yourselves the evil person” (1 Cor 5:13).
As Paul explains, when the church “keeps the feast” (i.e., the Lord’s Supper), they are to metaphorically “purge out the old leaven” (1 Cor 5:6-8). Hence, if you’re out of fellowship with a church for a just cause—for flagrant sin and rebellion and walking in darkness—that is a sign that you are also out of fellowship with God. And the opposite is true—if you are in fellowship with other believers, and allowed to take the supper, that is a sign you are in fellowship with God, too.
So Biblically speaking, fellowship with God is connected to fellowship with other believers.
But what if you who can’t fellowship with other believers—perhaps because you’re in prison, or the military, or in any area without any grace churches? What then?
In that case, you’re not at fault. Given those situations, we can expect that God will be merciful and understanding. But you still have options. You can fellowship with other soldiers, prisoners, or with your own family. Why not start a home church with your family? The Lord’s Supper was celebrated in the context of a Passover meal. Passover meals were celebrated by families. Likewise, I believe the Lord’s Supper can be celebrated by families. So can baptism. You’re called to fellowship with believers, not with a church building. God is everywhere, and you can fellowship with Him anywhere.