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. A vast and powerful military staffed almost entirely by Men of Iron meant that any attack or attempt by aliens to harm each other was quickly stopped, and peace and harmony ruled throughout the galaxy under humanity's "Pax Robitca". The humanist theories were lauded, understanding and compassion was considered virtuous, racism and intolerance was almost nonexistent, and science and reason ruled (religion did exist, but in what form or it's influence is unknown).
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 was the second largest empire and around this time they were begging he process that would lead to The Fall, which is where problems began. As human Psykers began to appear humans became vulnerable to daemons. Despite Daemons being quite rare thanks to humanity's efforts to create peace, the Eldar murder fuck orgies began to stir up the warp to a dangerous degree. Daemons began to manifest in larger and larger numbers, resulting in more and more possessions. Humans were forced to start using more extreme methods in an attempt to contain the problem, but the worst was yet to come despite these efforts.
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, the Men of Iron, the greatest bastion of reason, logic, law, and order turned on their human masters, butchering and slaughtering in vast numbers. 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 moths, or years, but what is known is that humans face with extinction burned down their own civilization to stop the rebellion.
Unleashing cyber warfare on a massive scale. Kill viruses, trojans, worms, and even EMP warheads were used to destroy every information system that was infected. 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 the Pax no longer enforced or even capable, aliens saw an opportunity to stop nodding and smiling at their overlords, and to reveal their true ambitions. The federation was destroyed in civil war as countless species abandoned pretenses and empty appeasement to conquer, loot, enslave, and murder. Aliens thus came to humans as raiders and warlords instead of allies or friends.
Meanwhile the Eldar's hedonism had reached critical mass, the various energies and emotions released during the extreme debauchery resulted in the birthing of a fourth dark god, Slannesh. The labor pains of the material universe as this being was being born 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 extinction or enslavement of humanity just as muhc as it doomed it.
Things would remain grim and dark into the late M29's and early M30's, ending with the birth of Slannesh. This sent a massive shockwave through the warp as she/him 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. If you believe a really old theory that doesn't get any attention anymore, being pushed out of a vagina somewhere in the mid-M2X's.