Connecting two output ports

That's a situation that should be avoided. What would be worse is a HIGH to LOW combination where the maximum current will flow and both Arduinos could be damaged. If there's a remote possibility of any two outputs being shorted then use a current limiting resistor as protection.

There's more you can do to protect an output as discussed here: Output Protection - General Electronics - Arduino Forum