I recently finished the book Passage to Dawn by R.A. Salvatore and in it a Balor warns a wizard of his Pit Fiend subordinates and a character uses an Imp to collect information from the Abyss. Now as far as I'm aware Demons and Devils don't cooperate and are from different planes of existence, Demons from the Abyss and Devils from the Nine Hells. I don't understand why an Imp and Pit Fiends would be in the Abyss unless they were at the time the book was published (1996) the same kind of creatures.
I'm not going to dig through my old 0e stuff but demons and devils were separate in the D&D 1e Monster Manual (1977), and were in the 2e 1990s as well (though actually renamed baatezu and tanar'ri for a while to avoid the Satanic Panic).
But you don't need that to understand why different critters are on a plane. When a wizard uses an invisible stalker to guard his tower do you wonder if they're the same kind of creature because they're on the same plane? Are all of the members of your PC party all the same alignment, because surely people of different alignments could never work together?
Imps make good spies because they can turn invisible. So you import one. In those days there was the concept of the Blood War where all the lower planes were fighting each other - and you don't fight someone else without going to their plane to stab them some.
They never were the same, ever, in the history of the game
At least, not in official material. (In that respect, the first word in @mxyzplk's answer is all that is needed for your bolded question: No).
Demons came first
OD&D did not start with demons, but it got them in supplement three (Eldritch Wizardry) in Types I-VI, Orcus, and Demagorgon. No devils. Alignment at that point was Law, Neutrality, Chaos.
Devils arrived with Two-axis alignment in AD&D, and the growing market
AD&D 1e added Devils, and also added the two alignment axis1 (Law to Chaos, Good to Evil) as well as the basic structure of the planes that has more or less survived with a bit of tweaking into the current edition. (PHB. 1e pages 119-121)
Devils were added before the PHB was published, in the Monster Manual for AD&D 1st edition; they were Lawful Evil.
The Devil's particular planes of the evil were in a quadrant of the great wheel anchored by the 9 hells, while Demons were Chaotic Evil and resided in their series of planes, to include the Abyss, on their quadrant of the great wheel. (Actually, in 1e, is was more of a square/rectangle).
That relationship has not significantly changed since then, though names and some details have been tweaked in various editions and source books. The point already made about the Blood War was added in the 2e AD&D era.
Why an imp and a pit fiend are in the same part of a given plane is easily explained: they both had a common interest. Evil doesn't mean stupid, nor inflexible. Plus, a writer of fiction does not have to constrain his muse by some "rules as written" dogma.
Rich Burlew makes that point in one of his comments at the GiTP forums regarding his story (Order of the Stick) and what use he makes of D&D 3.5 rules as a backdrop to the story. Salvatore likewise took considerable license with rules and lore when he dreamed up Drizzt Do'Urden ... so he can do the same with an imp and a demon.
1 While the Holmes blue book (OD&D reorganized) included the two axis alignment, itself originally published in Srategic Review, and it noted "demon" in the chaos/evil corner on the lower right (on page 8), that game release didn't have demons in it as a monster, and specifically referred to AD&D as what comes after that brief introduction. Devils weren't in the blue book either. For the purposes of the relationship between devils and demons, only the introduction of AD&D can address the alignment axis in a proper (and complete) context, complete with the monsters being in the published game. It is worth noting that conceptually, there was a place holder for devils as far back as the 1976 Strategic Review; in the lower right hand corner (CE) were demons in the Abyss, and in the lower left corner (LE) there were devils in Hell. (page 3, Illustration I, Strategic Review, Vol II #1, Feb 1976). Thanks to @ZwiQ for pointing this out.