Certainly writing to a routine helps as it keeps your mind focused and your fingers flexed. But not all of us can write every single day. We have various obstacles in our way; work commitments, family, lifestyle choices, I'm sure you can think of others. So does it hurt not to write every day?
No. Writing when you can will help keep your prose tight, refined and concise. You want every word to count when you don't know for certain the next time you will put pen to pad, or type away on your keyboard. One thing I've learned is we don't always have to be at a workstation to be writing, not for fiction anyway. We live our worlds in our minds through the day in our work places, or doing chores around the house/garden. It never leaves us, or it doesn't me. I write in my mind whilst showering, washing the car and such, so when I do find the time to sit at my desk, I know what I want to write, and set to it. It may not always be exactly what my mind's eye pictured me writing, word for word should I not have had my notepad handy, but this doesn't matter. It will be better.
Not writing every day will train you to become a quicker writer too. You should find yourself being able to write far more in one sitting purely because you aren't sure when you will have the opportunity again.
On a sort of flip side. Does writing every day have to mean writing your fiction/non-fiction book?
No. You could write in other ways on the days you just don't want to commit to writing the book. For instance take up writing in blogs. You become a better writer for it. You will find yourself thinking more thoroughly the words you type as you type for you know it is an instant thing and people will read your musings soon after you hit 'Publish'.
This can only be a good thing. Why? Well, it will aid your book writing, or rather the book editing process, as you will find you have less grammar errors to correct. And less editing is always a bonus... right.
So write every day if you can, but don't despair if you can't. You are writing when you can, and this can only enhance your craft skills.