As far as I can tell it has something to do with port forwarding the two ports
You are correct. In your case, you will need to forward both ports 22 and 5901, as you said. Instructions for doing this vary depending on your router, but the basic process is as follows:
- Enter your router's configuration page, and enable port forwarding.
Within your router's port configuration page, set whichever ports you want to be forwarded (22 and 5901, in your case) to be forwarded to your Pi's IP address. To do this you will need your Pi's local IP address, which is (in most cases) automatically assigned by your router via something called DHCP. The issue with this is that if, for example, your Pi is assigned a local IP of 192.168.0.11 today, it may be assigned 192.168.0.12 tomorrow. To ensure that the PI's IP remains constant, you'll have to edit the network configuration file for your distro's network manager. If you're using the Arch Linux image provided on the official site, you'll be using netcfg. Check some of the configuration examples on the Arch wiki for info on how to use a static IP.
Once port forwarding has been set up, SSH into your Pi by using your public IP address and the port specified in step 2. Keep in mind that chances are that your ISP does not supply a static IP to your router/modem, so your public IP may change from day to day.
One final note: If you're tunneling VNC through SSH, then I don't think you'll actually have to forward both ports, as the VNC session will be tunneled through one port through SSH. However, I'm not absolutely sure on this.