For example you have a program that runs on Windows, but you want to port it to Linux. Well Linux is a very different environment which means the program will have to linked against different libraries. E.g. For Windows the program may link to kernel32.dll, however that doesn't exist for Linux. There are functions that may be available on windows but not on Linux, and vice versa. Then there is the issue of different locations for libraries etc, and how these locations are specified. For example a path in Windows maybe "C:\Program Files\my_library.dll", however in Linux this would be "/usr/lib/my_library.so". Much of the fundamental code wouldn't change i.e printf() or scanf(), however they have to be linked to different locations.
These are just a couple of issues, but there are many depending on what the program does. Porting for Windows 98 to XP may not involve many changes but from Windows to Linux or Solaris or some other Operating system the change can be many.