Question: A book I am reading suggests compiling programs on the machines they are intended for to ensure there isn't any issues. One of the big reasons I wanted to learn C is because it (can be) compatible with all operating systems. I am using this one on linux. If compiling the program on the intended machine(s) is not an option, is there a procedure that can be followed to ensure the program will run perfectly regardless of what version of linux/bsd it is run on? Like a crib sheet of compatible functions for different O/S as well as different architectures, and how to deal with each difference to ensure compatability?

Answer: 
You're confused between source compatibility and binary compatibility. Binaries are most definitely not portable, and that's got nothing to do with the programming language. A binary compiled on BSD will never run on linux, for example, since all the syscalls have different numbers and conventions.

The C code though should be portable and compatible with a wide variety of OSes, if written carefully. You just have to compile it separately on each platform you target.
I would consult the following couple of links to get some basic information

<http://en.wikipedia.org/wiki/Linux_Standard_Base>

<http://www.linuxfoundation.org/collaborate/workgroups/lsb>