The reason for removing the batteries is two-fold:
On some hearing aids (such as my behind-the-ear Phonaks) opening the battery door will “restart” the hearing aid, but won’t turn it off. It temporarily turns off, then restarts in its “automatic” mode because the battery is still touching the electrical contacts.
Also, the battery is partially covering a section of the hearing aid (such as electrical contacts or the door) which may retain moisture and need to dry out. Removing the battery allows the silica gel dessicant in your dryer to get at all the moisture and do its job.
The dryer won’t harm the battery, but the battery (left in the hearing aid) is simply in the way.