The consequences of the Republicans winning depends heavily on exactly how they win.
For the Republicans to win requires two key things. The first is that it requires prompt and decisive action by local authorities within the first forty-eight hours of the beginning of the rebellion. Where civil authorities reacted swiftly and armed the militias, the rebellion either collapsed before it got going or was swiftly crushed. Where the civil authorities hesitated or acted indecisively, the Nationalists seized control. The resultant shape of the Nationalist held territory by the end of July 1936 reflected this almost entirely random process.
The second thing required for a Republican win is preventing the transport of the Army of Africa across the Straits of Gibraltar. The Army of Africa (AoA) represented the only reasonably well organised, trained and equipped force in Spain on either side. Unless they are prevented from landing in Spain a swift Nationalist defeat cannot be achieved, and a prolonged war favours the Nationalists.
Since the rebellion almost completely failed in the Spanish navy there is a real possibility of preventing the AoA from reaching Spain. The rebellion in the fleet had been a critical part of Franco’s plan and its failure necessitated a rapid rethink and the direct intervention of the Italians and Germans. Had Rome and Berlin been more cautious at this point the rebellion would have collapsed; the number of troops transported by Nationalist Breguets and Nieuports before the arrival of Italian Savoias and German Junkers was negligible.
On 19 July the Spanish government ordered all available warships to steam to the Straits to prevent the AoA from crossing. They were unsuccessful because the convoy of Nationalist troop transports was escorted by the German pocket Battleships Deuschland and Admiral Scheer. These two ships were, compared to the Spanish fleet, formidable. But there was only the two of them; their successful screening of the troop transports against a numerically superior Republican squadron would have been extremely difficult. This convoy included all of the heavy weapons used by the Nationalists in the first months of the war, so was absolutely critical. Had the Republicans chosen to attack the transports from multiple directions, and focused on the transports, not on the German warships, a great deal could have been achieved. The international repercussions of German warships opening fire on Spanish ships would have also been enormous.
If the rebellion was supressed, the Popular Front government and a democratic Spain is still extremely unlikely to survive. The provinces would have been in the hands of the various militias aligned with the main left wing political parties, or with the Basque and Catalonian provincial regimes; a struggle for power between the various left-wing parties, and between them and the Basques and Catalonians would be inevitable. Even during the Civil War, the threat of defeat and physical extermination by Franco’s forces wasn’t sufficient to prevent in-fighting between the Communists, Marxists and Anarchists; with the Carlists and Fascists defeated, fighting between the left wing elements would have been pretty much inevitable.
Even though Stalin had ordered the Comintern not to take a major role in the Popular Front government and the successive Republican governments, a Communist takeover is the most likely result of a civil war between them, the Marxists, the Anarchists and the regional regimes. Despite Stalin’s orders, the Spanish Communists were a bit too keen for glory and power to put off seizing control in Spain for the greater good internationally. As it was they disregarded the caution of the Comintern and effectively gained control of much of the Republican zone. Stalin was not acting out of altruism by the way; he didn’t want the British government to be alarmed at the possibility of the spread of international communism just when he was trying to forge an alliance with them against Hitler’s Germany.
A Communist takeover in Spain, even in a nominal coalition with other parties would still result in a massive bloodbath similar to that unleashed by Franco’s victorious forces. Not only would there be the (largely fictitious in 1936, it grew later) spectre of the Falangists to quite literally do away with, as well as the Carlists and Monarchists, but there are the provincial separatists and Marxists and Anarchists as well. The NKVD orchestrated purge in the rear areas of the Republican zone during the Civil War would have paled in comparison to what would have been unleashed by a successful Communist takeover.
Depending on when the Communists successfully took over significantly effects events, not only in Spain but also in during the European Crises of 1938 and ’39. An early victory would make the British establishment and the French Right even more paranoid of the spread of international Communism, a later victory just distracts from Hitler’s actions in central Europe. An early victory also deprives the Luftwaffe of a great deal of experience; experience that led to significant changes in German air tactics. A long drawn out and bitterly fought civil war in Spain between the various left wing parties could play completely into Hitler’s hands; distracting attention from his actions and hardening world opinion (i.e. British, French and American opinion) against Stalin.
By 1939 a Spanish Socialist Republic would most likely have a mutual defence pact with the Soviet Union. Even if they didn’t, Russia would still be the most likely source of their armaments. If they have a defence pact with Stalin, this would probably prevent a German invasion in the short term, but would almost guarantee a German invasion co-incident with the invasion of the Soviet Union.
A Spanish army operating in orthodox Soviet doctrine dominated by Soviet Commissars and equipped with old soviet equipment and with its airspace defended by I-15 and I-16s wouldn’t have presented much of an obstacle to the Wehrmacht and Luftwaffe. After several years of purges the Spanish people would probably have welcomed the Germans as liberators, at least initially, just as the Ukrainians and Baltic peoples did.
Once occupied, a guerrilla war would be the likely result, just as in the Balkans. And, just as in the Balkans, the Germans would have had just as many willing supporters as opponents, at least until the allies were able to provide effective logistical support and assistance. Even then the partisans are unlikely to affect any significant results until a major allied landing could take place.
Those landings would presumably take place on or after November 1942 instead of Operation Torch. Given the much broader, less mountainous terrain of Spain compared to Italy, a campaign in the Iberian Peninsula would probably significantly favour the allies.