There was a relationship between Sony and Nintendo starting in 1988 and into the early 1990s as someone in Sony was looking to get into the video game business after seeing how successful the Famicom was. Agreements were made with Nintendo to produce a CD-ROM technology add-on and work was started.
Prototypes were demonstrated in the early 90s which were compatible with the Super Nintendo, but also had additional capabilities based on some custom Sony hardware. Unfortunately, due to disagreements between Sony and Nintendo which mostly were around who retained the rights on the SNES-CD format, Nintendo pulled out and went with Sony's rival Philips for a similar component who would allow for Nintendo to retain their rights and tight control over content released for the device.
You can see more information at this wikipedia page.
From what I remember reading in books over the years, Sony was now sitting on this technology that they had developed and decided that they would take a gamble at going into the video game business. Ultimately with a few improvements this came out as the Sony PlayStation.
Now Sega did release a CD add-on for their popular Genesis console. However, I don't believe Sega ever had a relationship with Sony in the development of this device. The release of it, however, did coincide more-or-less with the development of the SNES-CD work. Sega's next console, the Sega Saturn, was CD-ROM based but I don't believe they ever leveraged Sony as they would have been a competitor by then.
One final note is that despite the development of the SNES-CD device, Nintendo did make the decision to not release any CD-ROM based devices until the release of the 2001 GameCube.