Yes you can!
However, the device that is under contract or lease will NOT be able to be used/activated.
You will need to have an unlocked device to port to.
Your device is under a financial obligation with another carrier or phone lessor.
If the financial obligations have not been met then that carrier or company will not release your device for activation elsewhere.
The phone number however is not under any obligations and therefore only the number can be switched over.