This popped up as a meme, so I had to look into it further to see if it was true. It is.
According to Variety: "After playing themselves in “A Hard Day’s Night” and “Help!,” the Fab Four was ready to play fictional characters. Apple Films executive Denis O’Dell spearheaded the hunt for material, and Lennon reportedly loved the idea of “Rings.” Lennon would play Gollum, Paul McCartney would play Frodo, George Harrison would be Gandalf and Ringo Starr would play Sam."
They approached Stanley Kubrick, who turned it down as unfilmable, probably due to the huge FX required for a fantasy story this epic.
But Kubrick saying no didn’t matter anyway because Tolkien said no to the film too, so it wasn’t happening with anybody. At least not then.
According to an interview with Peter Jackson on the BBC: “Ultimately, they couldn’t get the rights from Tolkien, because he didn’t like the idea of a pop group doing his story. So it got nixed by him. They tried to do it. There’s no doubt about it. For a moment in time they were seriously contemplating doing that at the beginning of 1968.”