This is a spiritual principle within the Bible: a certain group of people is defined by their beliefs. If a group of people all believe in the same thing, they can be said to be one. This is the principle of personification: this group of people can be personified as one person. See Ezekiel 16 for instance, where Jerusalem/Israel is personified as a woman. This woman is defined by the shared belief of Israel; their shared belief in the God of Israel. Exactly as Ezekiel 16 describes, this woman becomes a whore when she fornicates with the lesser gods of foreign nations and peoples, namely of the lesser gods of the Assyrians and Egypt. To fornicate with a lesser god (that is, a fallen angel) is to accept their seed. The seed of a lesser god is their doctrine (their set of beliefs). Israel became a whore by adopting the traditions, customs, beliefs, and religious practices of the lesser gods.
The Whore of Babylon follows the exact same spiritual principles as these. The Whore represents the world at large (made clear by Revelation 17:15, 18:3, and 19:2) which has adopted the doctrine of the fallen angels (which is all doctrine contrary to the word of God). The Whore represents everyone who is not Christ’s church, for everyone outside the church has adopted the doctrine of Satan. This is the imagery of Revelation: the Whore is a woman who is a filthy whore who has committed abomination after abomination (hence, The Mother of Harlots and Abominations of the Earth) while the Church is a woman who is a pure, innocent virgin. Jesus is going to marry the Church, while the Whore is going to face the wrath of God and be destroyed. It’s the exact same black and white symbolism as the wheat and the tares, the sheep and the goats, the righteous and the wicked, of good and evil. You are either for God or against God. You either belong to the Church or you belong to the Whore. The Church is defined by her belief in Christ and the Whore is defined her belief in the doctrines of demons. If you are not in the Church (defined by believing in the word of God), it means that you are accepting false doctrines, which means that you are fornicating with fallen angels. This means you belong to the Whore since you are partaking in her fornication (as in Revelation 18:3 and 19:2).
In Revelation 18:4, we read: “And I heard another voice from heaven, saying, Come out of [Babylon], my people, that ye be not partakers of her sins, and that ye receive not of her plagues.” God is telling His people to come out of Babylon. This is a spiritual command more than it is a physical one: God is telling His people to separate themselves from the Whore; to stop practicing her false doctrines; to stop participating in her sinful practices. Revelation 18:3 and 19:2 make it clear that essentially the entire earth has taken part in the Whore’s fornication (that is, of adopting the doctrines of the fallen angels). And so, to come out of Babylon is to stop participating in the doctrines of the world and to follow the word of God instead.