Russia underwent a massive crisis due to the war
Russia had to go through a tremendous number of casualties during WWI. Adding to that the economic crisis that struck the country, the land was propitious for revolution and Lenin and the Bolsheviks took the opportunity to overthrow the Tsarist regime and imposed communism. Russia was still pretty much a feudal nation and despite the abolition of serfdom in 1861, the lands were owned by aristocrats and workers were very few but very badly treated.
The war helped fulfill a change that was unescapable due to how unbalanced Russian society was socially speaking.
Nicholas II entered the war to jump-start Russia's dismal economy.
While his troops were away fighting the war, the Bolsheviks were able to wage their revolution with no interference from the military. Their previous attempt at revolution, in 1905, had failed and Nicholas underestimated their enduring popular support.