Can a damaged Time Machine disk harm my iMac when I will plug it in?

The iMac should not be harmed from plugging in such a disk, no. So in that sense it is "safe" to try.

However, note that there's a risk of further destroying data on the actual drive. It might work, but it might not. In any case, if it does work, I would suggest copying over any data you cannot afford to loose from the old drive to another drive.

If you have data on the drive that you cannot afford to loose, I would refrain from trying to do a lot with it yourself, and contact a data recovery service.