Supposably, Francisco Franco HAD wanted to develop nuclear weapons as a deterent from Morocco and Algeria moving against his African possessions. However, he did not have the money, and he did not have access to the proper technology. Portugal is in an even worse position.
In order to make this viable is for France to move forward with its initial proposal for a joint-development with Italy and West Germany, and also include Spain. Once they develop the weapon, arguably sooner then France did historically, Spain will then be able to create its own arsenal. Portugal on the other hand would need aid from Franco (quite literally it might mean them giving them the technology). There reason would be to hold onto their colonies, and to use them on concentrations of rebels; however, would they have the political will to give the go-ahead? Likely not. They would be compared to the regime of Adolf Hitler for such actions, in order to achieve a cause that is now looked down upon.
Therefore, you need some heavy changes to history in order for them both to develop such weapons.