IBM wanted an OS for a microcomputer (what they called PCs then), but didn't have one. They approached a few people and they didn't want to deal. IBM approached Bill Gates, he went out and bought the rights to the OS someone else had written and made a few changes then licensed it to IBM to use. Bill Gates did NOT write PC-DOS or MS-DOS but bought it and made a few minor changes. Gates then had others make improvements to have the later versions come out.
OS/2 was a much later development done as a joint effort until Gates walked away from it, taking most of the code as well and using that to create Windows NT, the basis for the current versions of Windows.
Keep Up with TechRepublic