I don't believe the conversation explicitly states that Tia Dalma gave the compass to Jack, but rather suggesting it was because of her, that he now has it.
TIA DALMA: The Compass you bartered from me. It cannot lead you to dis?
The wiki states:
Jack Sparrow's compass was an unusual navigational instrument most notably used by Captain Jack Sparrow, which he bartered from the voodoo mystic Tia Dalma and later inherited from his captain.
Honestly, this seems a bit ambiguous, and perhaps even a bit inconsistent in the timeline (Or maybe I'm just reading it wrong?). However, the evidence provided does have enough... room for interpretation, to allow for the story to fit appropriately:
- Jack, and Captain Morgan visited Tia Dalma in the past, and they bartered the compass from her.
- Morgan gives the Compass to Jack, during the events of Dead Men Tell No Tales.
- When Jack comes back to visit Tia Dalma in Dead Man's Chest, she is referring to the trade, not the ownership of the compass.
That being said, Dead Men Tell No Tales focuses heavily on the idea of "tribute" for a ship's Captain. Therefore it's probably more likely that Jack bartered it from Tia Dalma, and gave it to Morgan as Tribute. This does fit better, however the only ambiguous detail would then be how Morgan knew that one must not "betray the compass".