Does the president have the means to prevent a citizen from entering a country that is an island? Yes, obviously. The president controls the military so whether they take a boat or plane military vessels can "escort" them away from their intended destination.
Will such an action be upheld as legal in federal court? As with any case without precedent, this will be up to the ability of the lawyers on both sides and the ideology of the judges. But, we can make some assumptions and some predictions based on that.
To begin with,
there has not been any case in history where the free movement of US citizens has been restricted. (@Fizz Notes the case of Cuba, which affirms the president having such power). Yes, during open war, such as WWII, citizens could freely go to and from Germany. Whether this is because the president feels no need to do so or because such an act is illegal is up for debate.
But let us suppose that it is legal to do so (and the president gave such an executive order, which he did not so this case is already falling apart). Now we have to see if such an action applies to private citizens or officials performing their duties (as officials will have qualified immunity and would be exempt from prosecution even if it was breaking a law). It would be a difficult case either way to argue that this applies to officials so let's assume such a theoretical order applies to citizens.
Now we have the burden of showing that a congress member was performing this action as an official or a private citizen. Ignoring the obvious fact that any ranking member of government reflects the United States optically, we can simply look at whether official foreign visits are part of the duties of a member of congress. This one is likely a no, considering the primary role of congress is domestic affairs (and foreign affairs is up to the executive branch).
Regardless, considering the logical jumps at have to get to this point, I'm going to say that no judge is going to rule such an action to prevent Pelosi from visiting Taiwan is legal.
Side note: The US, along with most countries, do not officially recognize the sovereignty of Taiwan so a lot of the rules about other countries don't apply here.