There are not many precautions to be taken, since the 8051 ports are really open-drain with pullups. So aside from preventing their short to Vdd, there is not much else. Avoid driving them negative and over the Vdd level. That's about it.
This of course assumes that you will not be connecting them to high-voltage circuits.
1.In some conditions you need to use external pull-up resistors on port 0
2. A port pin can only source a very small current. So if you need to drive a led, for example, you'll connect the cathode of the led to the port and the anode to the supply voltage, through a resistor.