Yes, you can connect them directly. However, you *shouldn't* connect them directly. You should always, for safety's sake, include a small resistance (say 100? or so). That prevents a high current being drawn from one pin if it is set as an output and driven high, and the other pin for whatever reason should get set as an output and driven low.
I know you may not *intentionally* do that, but unexpected things do happen, and a 100? resistor is cheaper than a new microcontroller.