Galatians 4:8 Formerly, when you did not know God, you were slaves to those who by nature are not gods.
“did not know God” Prior to coming to know Jesus, to being born again, no one can “know” God. But in this context, Paul seems to use this to refer to the Galatians Greek/Pagan background. See I Corinthians 12:2, “You know that when you were pagans . . . “ and I Thessalonians 4:13, “like the heathen who do not know God." The Jewish mindset of Paul’s time was that pagans did not “know God.” Prior to the coming of Jesus, the covenant connection was with the Jews. It would seem at first blush that Paul is hinting that the Jews have a leg up on Gentiles, but actually, he is simply beginning a section where he will point out that not only is it wrong to insist on becoming like Jews in order to be a Christian, but that the Galatians were also dragging along many of their own pagan traditions and "worldly" mindsets into their Christianity.
“you were slaves” Again, here is a reference to slavery, which is a person who is the PROPERTY of another, without any rights. Earlier in the letter, Paul discussed being slaves to the law, before the Jews knew Jesus. Here he references an apparently even more cumbersome slave master – the world at large. Regardless, the only freedom is in a relationship with Jesus.
“to those who by nature are not Gods.” These are the pagan deities the Galatians once worshiped. Pagans believe that what they are worshiping are indeed Gods. After coming to know Jesus, of course, we realize that they are not Gods at all. Indeed, the Pagan Gods were almost always connected to some object in the creation – the sun, the moon, the stars, the sea, the sky, the animals, the seasons etc. The sin of idolatry is to worship a created thing as if it were the Creator. Prior to becoming Christians, this was all the Galatians knew.