What distribution are you using?
The manual way to do it (and the way I'd do it in Debian) is to put links to the program in /etc/rcn.d/ , where n is each runlevel number in which you want the program to run. For example, you might put a link called S99myprog in /etc/rc2.d, /etc/rc3.d, /etc/rc4.d, and /etc/rc5.d.
However, runlevels vary according to the distro; you would need to check what your distro uses. You might also be better off following your distro's standard procedures for installing daemons.