No, it doesn't affect the hard drive in the short run. formatting is just a process of erasing the master file table (in quick format) or rewriting the drive (in complete format). Defragmentation is much more taxing on the hard drive than formatting.
But why would you need to format frequently? If it is due to OS issues, try using a good antivirus and some utilities like ccleaner, revo uninstaller or tuneup utilities. Use a opera, firefox or chrome for web browsing rather than internet explorer. One installation should easily last for 6 months to 1 year. Use portable versions of firefox, thunderbird etc. to keep the registry & documents & settings folders cleaner.