In The Return of the King, Pippin holds Palantír in a scene. Then Gandalf takes him. And when Merry breaks up with Pippin, he says
The enemy thinks you have the ring.
Why does the enemy think so? I don't understand that. Any idea?
Sauron is aware that Gollum owned the ring for many years and lost it to "Bagginses" from "The Shire". He sends the nine Ring Wraiths to look for it. They will have learned that the ring is being carried by a team of small people called Hobbits, but the Nine are defeated at the border of Rivendell.
The next thing that Sauron hears is when a small person appears to possess the Palantír last held by Saruman. He has no idea that this is the right Hobbit, but based on this information he may be guessing that the Hobbit with the Palantír is either:
Either scenario may be bad for Sauron. Potentially he might need to face Saruman with the ring in his possession or face whoever defeated the power of Saruman and Isengard.
In any case, Sauron makes the assumption that this Hobbit is the one he is looking for, and that the Hobbit or someone else in the Hobbit's party have the ring. Gandalf uses this to his advantage by drawing the attention of Sauron towards the west, away from where they hope Frodo and Sam are infiltrating.
Sauron knew that a hobbit had the ring, and knew that Saruman had been searching for it as well.
The book makes it clear (if we trust that Gandalf's guesses about Sauron's state of mind are correct) that when Sauron saw Pippin using the palantír, Sauron knew nothing of Saruman's defeats and thought that the palantír was still in Saruman's possession in Orthanc. Therefore Sauron thought that Pippin was Saruman's prisoner and was being forced to look into the palantír and make contact with Sauron.
The Enemy, it is clear, thought that the Stone was in Orthanc - why should he not? And that therefore the hobbit was captive there, driven to look in the glass for his torment by Saruman.
Why would Saruman do this to a random Hobbit? It would have seemed obvious to Sauron that this was an important prisoner, and it appears he leapt straight to assuming this was the Hobbit who had carried the ring.
Gandalf also says:
If he had questioned you, then and there, almost certainly you would have told all that you know, to the ruin of us all. But he was too eager. He did not want information only: he wanted you, quickly, so that he could deal with you in the Dark Tower, slowly.
So Sauron simply assumed that a Hobbit contacting him out of the blue on the Orthanc palantír could only be the ring-bearer captured by Saruman, and did not learn the true state of affairs since he did not interrogate Pippin at that time.
The same basic facts and reasoning would apply in the film version as well (I don't recall whether Gandalf has similar exposition lines in the film or not).
The question is movie-based. There is no suggestion in the book that Sauron thinks that Pippin has the Ring. All we know is Gandalf's view of the event, as outlined by Ben.
We can charitably say that Merry knows what Sauron thinks because Jackson needs to create "drama." It is actually one of Jackson's better attempts.