Age of Strife
The Age of Strife, also known as Old Night, is a period of the history of Warhammer 40,000, prior to the creation of the Imperium of Man. Very little is known as only a few fragments survived but we know the broad details based on what is found throughout the lore.
After figuring out the Warp Drive and the Navigator gene in the late M1X's, humanity was able to spread out from the solar system to other stars, and with the STC system, they could make anything they needed no matter where they landed. All basic human needs were met by the Men of Iron; a sentient species of machines capable of complicated calculations, computations, advanced reason, and even engineering and design beyond any human capacity. Apart from the upper government, Men of Iron also managed every system, worked in hospitals as surgeons and doctors, and even as household servants. This golden age of plenty meant that humans spent nearly all their time relaxing, exploring the arts, sciences, and whatever took their fancy as work became more of a hobby than a necessity.
Humanity had also formed into a star federation large enough to hold massive amounts of territory encompassing dozens of alien species. While nothing is known of how it was governed, the fact of the matter was that it was considered the peak of humankind's advancement and an unsurpassed age of peace and prosperity that even the days of the Great Crusade could not match.
Unfortunately underneath this shiny exterior there were problems. Despite humanity's rule and belief that they had enlightened the cruel and barbaric xenos species, most of them still hated each other. Lessons of compassion and empathy had not taken root and the only reasons that various aliens did not try to wipe each other out was because of the omnipresent Men of Iron on every world enforcing the laws set down by humans. Despite the massive technological and societal improvements humanity had brought, and the unending peace and prosperity, many aliens resented humans for taking away their rights to slaughter, kill, and conquer at a whim.
The Eldar Empire was still the dominant power in the galaxy at this time, even though they had grown increasingly detached from the affairs of "lesser races". Although it is probable that they had some kind of contact with humanity, no information exists to confirm or deny that they even knew of one another's existence. Around this time, Eldar culture had begun to devolve into the hedonistic excess that would eventually form Slaanesh, and the unborn Chaos God's growing power would be fatal to the human federation. As human psykers began to appear in significant numbers, daemonic incursions became a new threat due to the Eldar murder fuck orgies stirring up the warp to a dangerous degree. Mankind had never encountered daemons in the past, and so they were completely unprepared for the new threat from beyond. Their policies of tolerance began to backfire as well; many world's refusal to control psyker populations inevitably led to disaster as their psychic activity attracted the attention of Chaos entities.
What happens next is mostly conjecture based on what is seen in various sources including Tanith First (And Only), Codex books, and the Horus Heresy series.
Possibly corrupted by warp energies or maybe simply deciding that they ought to be the masters of mankind instead of the servants, the Men of Iron that humanity had depended on for so long violently rebelled. The unprepared humans were faced with extinction unless drastic action was taken. Worse still, the Men of Iron existed not just as hardware, but also as software, allowing them to infiltrate human systems and computers at lighting speed. Using interstellar communications the corrupted Men of Iron spread like fire, destroying, killing, and corrupting other Men of Iron as they went. This war may have lasted months, or years, but what is known is that humanity triumphed, at the expense of losing everything it had gained over the centuries.
After the war settled down, the cost was immense. Massive deaths had left many worlds barren of all human life, while on worlds with surviving populations many humans died of hunger, disease, or injury as infrastructure usually managed by Men of Iron such as hospitals and farms were left abandoned due to lack of qualified personnel. In the face of all this, humans turned to aliens for aid as they had been somewhat untouched by the rebellion.
The aliens did respond, but not with food or medicine. With the humans and their peace no longer enforced or even capable of defending themselves, aliens saw an opportunity to stop nodding and smiling at their overlords, and to reveal their true ambitions. The federation was destroyed, both by alien invasions from without as treaties and agreements were thrown aside by aggressive species and from within as aspiring warlords and tyrants attempted to carve out their own empires from the remains of their old civilization. This constant infighting would continue until the Emperor reunited Terra and attempted to recreate the old federation in the Imperium of Man.
Meanwhile, the Eldar's hedonism had reached critical mass, the various energies and emotions released during the extreme debauchery resulted in the gestation of Slaanesh. The labor pains of the material universe as this being was being born echoed through the galaxy creating massive warp storms cutting the galaxy into pockets of space removed from each other by unending storms. This left human worlds cut off from both each other and alien armadas, ironically preventing the complete extinction or enslavement of humanity just as much as it doomed it.
Things would remain grim and dark into the late M29s and early M30s, ending with the birth of Slaanesh. This sent a massive shockwave through the warp as she/he screamed his/her cry, cutting though the storms and ripping apart the heart of the Eldar empire only to replace it with the Eye of Terror.
What the Emperor was doing while everything fell to pieces is anyone's guess. You'd think he would have at least attempted to prevent it, if nothing else.