Possibly, and then again possibly not.
Many system hard discs have a small partition that contains info that links to the recovery disc. If you change the drive then that information is lost. In that case the recovery disc will not work. I have seen this happen on a number of occasions. But you may be lucky. There is only one way to find out, unless anyone else knows about these machines.
If it won't work with a new hard drive you will either have to buy a new retail operating system, or purchase the new disc from Compaq, if one ist still available.