Franco's Army was battle hardened, and resources from Portuguese colonies could have helped German War effort. Not to mention the presence of Spanish and Portuguese troops in North Africa and France would have freed up additional manpower for the Eastern Front. And Italy and Germany were vital in Franco's victory in Civil War.
As you indicate, there are a few reasons why we might expect Franco's Spain to have joined the Axis during the Second World War. Ideologically, while Franco might not have been a fascist himself, he clearly had some affinity with fascism and sympathy for Germany and Italy. From their perspective, Spain's participation in the war would have been advantageous in some ways - it would have enabled the Axis to capture Gibraltar for one. However, it's worth noting that many of the strategic benefits Spain could offer Germany were available without Spain joining the war. Spain, despite its official neutrality, did let German u-boats use its ports to fight in the Battle of the Atlantic. Spain already exported a lot of its crucial mineral resources to Germany, which had been arranged as a form of payment for Germany's intervention in the civil war. Germany also made use of some Spanish manpower on the Eastern Front, in the form of the volunteer División Azul or Blue Division, which fought until 1943 (with some individual members choosing to fight on even after the unit was officially withdrawn).
So, the added benefit of having Franco join the war was real but not overwhelming. Remember that the Spanish Army was large, but poorly equipped compared to the major combatants, and Spain itself was still exhausted after three years of a bloody civil war, struggling to feed itself, let alone support a new war effort. Spain (and Portugal for that matter) were also highly vulnerable to the Allies. Spain relied on energy and food imports from the United States and Britain, who were also in a position to cut off just about all of Spain's overseas trade. Both Spanish and especially Portuguese imperial holdings were also highly vulnerable in the face of Allied naval supremacy - there is no way they could have maintained lines of communication to their colonies.
What this overall picture meant was that from the Spanish perspective, joining the war needed to be low risk and high reward, while from the German perspective, the additional benefits were not large enough to want to pay a high price. In a very famous meeting, Franco and Hitler journeyed to the border of France and Spain at Hendaye in October 1940. If Spain was going to join the war, now was the time - their neighbour had been soundly defeated, and Germany seemed poised to crush Britain. There is still debate about whether Franco was genuinely interested in joining the war or cleverly playing Hitler along to avoid going to war while maintaining a pro-Axis facade. Franco notoriously arrived hours late to the meeting - which has been explained either as a clever bit of diplomacy to show Hitler up, or as testimony to just how poor a state Spanish railways were in in 1940. At the meeting, Franco essentially presented Hitler with a long shopping list in the form of military/economic aid and territorial concessions that Spain would need if they were going to join the war. Hitler, doubtless thinking that this was a ridiculous price to pay for Spain to enter a war that was practically already won (andmoreover would mean alienating the new French Vichy regime by giving Spain large swathes of its North African territory), refused.
My perspective - and I think it is now more or less the historical consensus - is that Franco was not deliberately stalling Hitler to keep Spain out of the war, but his demands reflected the reality that Spain was unprepared and vulnerable after the civil war, and required huge amounts of aid to actually be in a position to fight as well as sufficient rewards to make it all worthwhile. Over the next couple of years, this basic equation didn't change - the price of Spanish entry to the war stayed too high for the Germans to pay, especially as Spain continued to push the boundaries of neutrality in collaborating with them. By 1943 (as hinted above with the withdrawal of the Blue Division), when it was clear that the tide of the war was turning, the temptation to join in faded rapidly, and Franco took steps to realign Spain away from the Axis.
***
Much of the literature on post-civil war Spain/Franco deals with the question of Spanish participation in the Second World War. Stanley Payne's Franco and Hitler: Spain, Germany, and World War II (Yale, 2009) is probably the most in depth treatment. Paul Preston - who is much more critical of Franco in general - has also written a great deal on the subject, notably 'Franco and Hitler: The Myth of Hendaye 1940', Contemporary European History 1:1 (1992), pp. 1-16.
Hi, there is always more to be said on the matter but you might be interested in this answer by /u/Georgy_K_Zhukov on the Spanish side of things.
For the portuguese, the question is probably better phrased as why didn't they join the allies. Portugal and the United Kingdom have been allied in one form or another since 1373, the longest such alliance in history. In terms of tactical benefits, it was in the interests of the British for the portuguese to remain neutral, as portuguese neutrality reduced the risk of Spain joining the Axis powers. The disadvantage of having large parts of the Iberian peninsula fall under axis control far outweighed the military benefits that Portugal could offer. One senior official opined that 'the value of the portuguese army in the field is probably nil'. A memorandum issued by the British Foreign Office shortly after the war began sums up the situation as follows:
His Majesty's Government in the United Kingdom much appreciate the assurances given by the Portuguese Government on the 1st September and agree with them that observance of neutrality by Portugal would best serve the mutual interests of both Portugal and Great Britain in the present emergency. They are also in agreement with the decision of the Portuguese Government to refrain from making any declaration of neutrality
While Portugal remained neutral throughout the war, they were sympathetic towards the allies, and offered the United Kingdom access to naval and air facilities in the Azores, which proved useful as a stopping point for transatlantic travel. Portugal took a dim view of German anti-semitism and racism and took in over 100,000 refugees, many of whom continued onwards to the US. Portugal also hosted almost the entire civilian population of Gibraltar.
Had the British invoked the alliance in a time of desperate need, it is likely that Portugal would have responded. When the British asked for use of bases in the Azores, Salazar needed no persuasion to agree. In 1944, Portugal also agreed to stop Tungsten exports to Germany. However, it was viewed as strategically necessary for Portugal to remain neutral in order to keep Spain out of the war. Given the close links and alliance between Britain and Portugal, there was absolutely no chance of Portugal joining the Axis powers in hostility against them. Simply because the two countries shared some characteristics of Government did not mean that they were natural allies.
Sources:
Joaquim da Costa Leite, 'Neutrality by Agreement: Portugal and the British Alliance in World War II', American University International Law Review. Vol 14, No. 1 (1998)
Glyn Stone, 'The Official British Attitude to the Anglo-Portuguese Alliance, 1910-45', Journal of Contemporary History, Vol. 10, No. 4 (Oct., 1975)
For further reading on the alliance before the war:
Edgar Prestage, 'The Anglo-Portuguese Alliance', Transactions of the Royal Historical Society, Vol. 17 (1934), pp. 69-100