'I could not take it from [Bilbo] without doing greater harm; and I had no right to do so anyway. '
'And I could not “make” you – except by force, which would break your mind.'
So says Gandalf to Frodo in The Shadow of the Past about the consequences of taking the Ring by force. Presumably Gandalf reckons 'breaking the mind' of Bilbo to be the 'greater harm' he would have done, and we can certainly see how paranoid and close to violence Bilbo comes when Gandalf pushes him to leave the Ring to Frodo, as he wished and promised to do until the moment came in which he had to do so (FR 1.i.34). Bilbo laid his hand on the hilt of his sword. Taking hold of a weapon in the middle of a heated argument is not what you'd call a subtle hint. It's a threat. (Trust me.) How much farther would Bilbo have gone if Gandalf had actually tried to take the Ring?
As for Frodo, who later does have the Ring taken from him by force, one may question whether his mind is broken by losing it in this way. Tom Shippey certainly does in J. R. R. Tolkien, Author of the Century (118), not without reason, but the Frodo who loses the Ring to Gollum is not the same Frodo as the one Gandalf is speaking to in The Shadow of the Past. He has changed in ways both good and bad in the meantime; and he is broken by losing the Ring, in spirit if not in mind, and even if this is not immediately clear: "'It is gone forever,' he said, 'and now all is dark and empty'" (RK 6.ix.1024).
But there is another aspect to seizing the Ring by force, whether that force is physical or not, which the story of Gollum and the words of Gandalf should make us consider. Gollum took the Ring by force from Déagol, claiming the Ring as his due because it was his birthday and committing murder to enforce his claim. His claim to the Ring wasn't even specious. He had 'no right to [take it] anyway'. The violence he does to his own mind and soul is perhaps greater than that which he does to poor Déagol's body. And when he seizes the Ring a second time, from Frodo in the Sammath Naur, he is twice described as 'like a mad thing' (RK 6.iii.946). This should give us pause. For not only would Bilbo have been harmed, had Gandalf taken the Ring taken from him by force, but committing such an act would have been harmful to Gandalf himself. If refraining from unnecessary violence was able to slow the effect of the Ring on Bilbo, not doing so, as the tale of Sméagol and Déagol indicates, only speeds that effect. So, whatever protection from the pull of the Ring Gandalf's motives might have afforded him would have been negated by the harm he would have done himself in harming Bilbo.
This should come as no surprise. The Ring was made specifically to enable its bearer to dominate the wills of others. To begin one's possession of the Ring with an act of domination, whether physical or spiritual, with good intent or ill, was to court one's own domination by the Ring. We might also find a pattern for Gandalf's wisdom in that of Elrond who, failing to persuade Isildur to cast the Ring into the fire 3,000 years earlier, made no attempt to take the Ring from him by force. He knew better. He knew that to do so was to fall.