The 1300s were not really known as being a bastion of human rights. Witches, Crusades, feudalism, etc. The Enlightenment had not even come into force yet.
So what led to Louis X adopting such a remarkably liberal political position this early on?
There have been a number of great works looking at issues connected to this idea of French soil being inherently adverse to slavery-- a trope highlighted in the rhetoric of French revolutionaries during just about every revolution. Two that spring to mind right away are Sue Peabody's "There are no slaves in France," and Gillian Weiss's "Captives and Corsairs." The first deals with the legal limits of this belief, the latter deals with slavery in Mediterranean.
One of the things that comes out of these works are the limits of this belief. Louis is really speaking to the Mediterranean slave trade, as this predates European involvement in the Atlantic slave trade by a bit more than a century. Slave raiding was pretty common practice during the early modern period in the Mediterranean; slaves could be used on galleys, in fields, or in a capacity that made use of their special skills (reading, writing, maths, etc.). There was also a big business centered around ransoms, especially if they came from- or claimed to come from a rich or well to do family. And this was true of slaves captured by Christian as well as Muslim polities. To support this, there were also a number of religious orders dedicated to the manumission of slaves- basically to facilitate the payment of ransoms.
One of the things Louis is doing, is basically denying the right of people to bring Europeans back to France in shackles to be ransomed, prevent foreign rulers from bringing slaves (especially captured christians), and making a symbolic move towards a higher morality-- that he personally does not condone slavery and that it is an anathema to being in France. This didn't necessarily cut the slave industry though-- rather it remained common for Muslim slaves to be used on French galleys. After all, if your below decks on a ship, your not really on French soil are you?
There was also a lot of symbolism involved in the role the French monarchy played in paying ransoms; slaves they freed would be publicly paraded from their port of entry to the King. Part of the parade is the first steps on French soil and the return to a state of natural freedom before traveling to thank the King.
The idea that France was an anathema to servitude remained strong- but came up against the realities of France's involvement in the African slave trade- a question that Peabody does a great job of analyzing through court documents. Rich merchants and planters from the Americas frequently expected to bring their slaves with them when they visited France, they had a lifestyle they expected to keep up. So they had to find ways to keep slaves while still abiding by this rule-- for some this meant telling their slaves the rule wasn't true, or temporarily freeing them and making them sign a contract-- there were all sorts of different strategies. And there were anti-slavery groups that tried to undermine them. The problem often hinged on whether the enslaved person thought they were better off in their current place- or becoming free in a strange land in which they had little connection of knowledge. Fear of the unknown or dealing with Frenchmen who had likely seen few dark skinned individuals likely kept many slaves from making a case for freedom while in France. Such is also the case of Thomas Jefferson who brought two slaves, Sally Hemmings (his wife's half sister and later mother to several children by him) and one of her brothers, with him to France. Historians have puzzled why they didn't seek freedom while in France, especially the brother since he was there train as a French chef for Jefferson and likely picked up enough of the language to learn about French anti-slavery laws. The Jefferson story is perhaps a bit off track since there are larger family entanglements involved, but it's a good example of a well known individual who sought successfully to subvert this belief that slavery could not exist on French soil.
*sorry for any errors/typos, on my mobile.
Followup question: Does this have any connection to the later doctrine of the "free air of England"? Were there systematic differences in how they were applied?