Yes, the defrag process will be affected if the computer goes into Sleep Mode.
"Sleep is a power-saving state that allows a computer to quickly resume full-power operation (typically within several seconds) when you want to start working again. Putting your computer into the sleep state is like pausing a DVD player—the computer immediately stops what it’s doing and is ready to start again when you want to resume working."
Source:
http://windows.microsoft.com/en-us/windows7/Sleep-and-hibernation-frequently-asked-questions
After a period of inactivity by the user the computer will enter sleep mode and the defragging process will halt.
http://answers.yahoo.com/question/index?qid=20090509012913AAmhvZW