The passage in question comes from Appendix A to Return of the King:
Among many cares he was troubled in mind by the perilous state of the North; because he knew then already that Sauron was plotting war, and intended, as soon as he felt strong enough, to attack Rivendell. But to resist any attempt from the East to regain the lands of Angmar and the northern passes in the mountains there were now only the Dwarves of the Iron Hills. And beyond them lay the desolation of the Dragon. The Dragon Sauron might use with terrible effect. How then could the end of Smaug be achieved?
None of this actually implies that Sauron had to force or compel Smaug to do anything; in order to destroy Rivendell, for example, all that's needed is for Smaug to be pointed in the right direction and left to do his own thing.
The Hobbit notes that rumour of the wealth of Erebor was probably what had brought Smaug there in the first place:
...So my grandfather's halls became full of armour and jewels and carvings and cups, and the toy-market of Dale was the wonder of the North.
Undoubtedly that was what brought the dragon...
So in order for Sauron to destroy Rivendell, or Lórien, or any other kingdom he wished, it would have been sufficient to spread rumour of wealth there too.
Despite all of this, the probability is that Sauron actually would have been able to command Smaug.
We must not forget (from the Silmarillion) that Sauron was Morgoth's second-in-command, he commanded Angband before the Chaining of Melkor, and "kept the seat warm" for Morgoth while he was in captivity in Valinor.
And Melkor made also a fortress and armoury not far from the north-western shores of the sea, to resist any assault that might come from Aman. That stronghold was commanded by Sauron, lieutenant of Melkor; and it was named Angband.
We also know (also from the Silmarillion) that Balrogs remained in Angband during the captivity:
Far beneath the ruined halls of Angband, in vaults to which the Valar in the haste of their assault had not descended, Balrogs lurked still, awaiting ever the return of their Lord; and now swiftly they arose, and passing over Hithlum they came to Lammoth as a tempest of fire.
Putting two and two together here, we see that Sauron quite likely had (at least some) authority over Balrogs during the First Age, so commanding a mere dragon should have been well within his capability (yes, I know there are some that believe that dragons are Maiar, but there's absolutely no evidence in Tolkien's writing to support that belief).
Finally, Gandalf as a Maia evidently believes that Sauron would have been able to use the dragon, and we must assume that Gandalf is in as good a position as any to know what the capabilities and limitations of another Maia are.