Mega2560 R3 pin functions
Yes. Any pin can be used as a digital input/output. However, you cannot use certain communications when using those pins.

The types of communication and their effects on the pins:


SPI: This protocol is used for certain communications with certain breakout boards and shields. For example, the ethernet shield uses SPI to connect. On the Mega(2560), it is pins 50-53.
I2C: This protocol is also for connecting to external items. It is much slower than SPI, but uses only two pins. On the Mega, it uses pins 20/21.
UART/Serial: UART is a communication method that uses two wires and transmits bytes of data. It is often used to connect to things that don't need extreme amounts of data passed, but need a stable two way connection.


On all standard boards, the main UART is on pins 0 and 1. This is usually connected to a UART to USB chip which is sent to the computer. Note: you should still be able to upload sketches if they act as an output and random on/off won't hurt the device.
The Mega(2560) also has UART on pins 14/15, 16/17, and 18/19.