There are I/O ports which are used to communicate with hardware. For instance, the old SoundBlaster cards were generally assigned port 0x220 to 0x230 and information could be written to and read from these ports to control the card.
There are also the ports in the TCP/IP stack which are virtual end points for communication over the internet. Do a netstat -a in a cmd shell to see what connections your computer has open at any one time. There are a total of 65536 potential ports. Programs like P2P file sharing use multiple connections to different peers so as to get a higher number of users from the network.