It is possible that the optical drive is defective, dirty, or the OS X DVD is damaged. I have a MacBook Pro that often has trouble reading DVDs/CDs. I use an external DVD-RW connected via USB to get around this.
However, it does appear that the problem is intermittent. BTW, does the system seem to randomly eject the DVD? Could just be dirty. Try blowing out (nothing the lose) anything, with a can of air, from inside the slot.