In an essay for JSTOR, Livia Gershon writes about the meaning of the prohibition of marks in the Torah:

But in the ancient Middle East, the writers of the Hebrew Bible forbade tattooing. Per Leviticus 19:28, “You shall not make gashes in your flesh for the dead, or incise any marks on yourselves.”

Historically, scholars have often understood this as a warning against pagan practices of mourning. But language scholar John Huehnergard and ancient-Israel expert Harold Liebowitz note that the appearance of the ban on incisions—or tattoos—comes right after words clearly related to mourning, perhaps confirming the original theory. And yet, looking at what’s known about death rituals in ancient Mesopotamia, Syria, Israel, and Egypt, they find no references to marking the skin as a sign of mourning. They also note that there are other examples in Leviticus and Exodus where two halves of a verse address different issues. So that could be the case here, too.

What tattoos were apparently often used for in ancient Mesopotamia was marking enslaved people (and, in Egypt, as decorations for women of all social classes). Egyptian captives were branded with the name of a god, marking them as belongings of the priests or pharaoh. But devotees might also be branded with the name of the god they worshiped.

So, it was ban on the basis of it indicating slavery. Yet, the Bible seems to permit a tat that indicates slavery to God in Isaiah 44:5

This one will say, “I am the LORD’S,”
another will be called by the name of Jacob,
yet another will write on the hand, “The LORD’S,”
and adopt the name of Israel.