Muslims have been told through the divine revelation that dead people live in a different world with different criteria and dimensions. Thus, it is completely nonsense to apply our physical laws to a metaphysical world.

Regarding the ruling of autopsy and whether it hurts the dead or not, Dr. Mohammad Naim Saei, said:

It is permissible in Islam to perform an autopsy when it is necessary, especially in crime cases, to investigate the real reason for death.

When a person dies, he or she will be transferred as a soul into a different world, which we know little about from a physical point of view. When the Prophet (peace and blessings be upon him) indicated that a person who dies hears and recognizes the people who are visiting him or her, this indication was in regard to the soul, not the body. So, there is no contradiction in this issue.