A slightly larger context answers this question.
31 Then said Jesus to those Jews which believed on him, If ye continue
in my word, then are ye my disciples indeed; 32 And ye shall know the
truth, and the truth shall make you free. 33 They answered him, We be
Abraham’s seed, and were never in bondage to any man: how sayest thou,
Ye shall be made free? 34 Jesus answered them, Verily, verily, I say
unto you, Whosoever committeth sin is the servant of sin.
Jesus states in vv.31-32 that if these who are believing on him continue in His word (i.e. the truth), then that truth will make them free. The Jews reply with your verse's content: "We be Abraham’s seed, and were never in bondage to any man: how sayest thou, Ye shall be made free?"
They are replying to Jesus' assertion that they are not free, when they believe they are. And indeed, from this statement it appears that they as individuals are free (they apparently were not and had never been slaves, nor incarcerated).
They are not making a statement about their national history, but themselves as individuals, and likely as the Jewish nation at that time. During these years, while the Jews were under Roman rule, they were not without freedom. To quote from the Wikipedia article on Romans in Jerusalem:
During the 1st century BCE, the Herodian Kingdom was established as a
Roman client kingdom and in 6 CE parts became a province of the Roman
Empire, named Iudaea Province.
Julius Caesar formulated a policy of allowing Jews to follow their
traditional religious practices,a policy which was followed, and
extended, by Augustus, first emperor of Rome, reigned 27 BCE-14CE.
This gave Judaism the status of a religio licita (permitted religion)
throughout the Empire.
So they had some political freedom, religious freedom, and some were Roman citizen's (like Paul, Act 22:28). This is the type of freedom they are referring to.
And then Jesus points them to his meaning: they can be free from sin if they "continue in [His] word," (i.e obey) and "know the truth." Otherwise, they are in bondage to sin, and are serving it.