"'Something' was written on the piano while we were making the White Album," George Harrison explained in 1980. "I had a break while Paul was doing some overdubbing, so I went into an empty studio and began to write. It didn't go on the White Album because we'd already finished all the tracks."
On April 16, 1969, Harrison, Paul McCartney and Ringo Starr attempted 13 takes of the basic track with George Martin on piano (John Lennon was present but did not contribute). This effort was abandoned on May 2, when the band recorded 36 takes of the backing track in Studio Three. All four Beatles participated, joined by "Get Back" session keyboardist Billy Preston on piano.
Source: Guitar World