Just remember to pay attention to the whole context or passage instead of getting lost by one sentence. The context makes it clear, they were referring to themselves in pride & privilege by saying we are Abraham's seed. They were not referring to the whole Israelites from history. Their own generation was not living in slavery despite being under the Roman rule. They were later massacred and sold as slaves after the destruction of Jerusalem in 70 BCE.
[NASB John 8:31-44] 31So Jesus was saying to those Jews who had believed Him, "If you continue in My word, [then] you are
truly disciples of Mine; 32and you will know the truth, and
the truth will make you free." 33They answered Him, "We are
Abraham's descendants and have never yet been enslaved to anyone; how
is it that You say, 'You will become free '?" 34Jesus
answered them, "Truly, truly, I say to you, everyone who commits sin
is the slave of sin. 35"The slave does not remain in the
house forever; the son does remain forever. 36"So if the
Son makes you free, you will be free indeed. 37"I know that
you are Abraham's descendants; yet you seek to kill Me, because My
word has no place in you. 38"I speak the things which I
have seen with [My] Father; therefore you also do the things which you
heard from [your] father." 39They answered and said to Him,
"Abraham is our father." Jesus said to them, "If you are Abraham's
children, do the deeds of Abraham. 40"But as it is, you are
seeking to kill Me, a man who has told you the truth, which I heard
from God; this Abraham did not do. 41"You are doing the
deeds of your father." They said to Him, "We were not born of
fornication; we have one Father: God." 42Jesus said to
them, "If God were your Father, you would love Me, for I proceeded
forth and have come from God, for I have not even come on My own
initiative, but He sent Me. 43"Why do you not understand
what I am saying? [It is] because you cannot hear My word.
44"You are of [your] father the devil, and you want to do
the desires of your father. He was a murderer from the beginning, and
does not stand in the truth because there is no truth in him. Whenever
he speaks a lie, he speaks from his own [nature], for he is a liar and
the father of lies.
The corrupt Jews were very proud and arrogant on their religious heritage, being confident of themselves due to their religious ancestry, similarly to what many Christians might be today for their religious status in abandoning the true meaning and spirit of religion. This encounter with John the Baptist reveals a similar exchange.
[NASB Matt 3:7-9] 7But when he saw many of the Pharisees and Sadducees coming for baptism, he said to them, "You
brood of vipers, who warned you to flee from the wrath to come?
8"Therefore bear fruit in keeping with repentance;
9and do not suppose that you can say to yourselves, 'We
have Abraham for our father'; for I say to you that from these stones
God is able to raise up children to Abraham.