According of what is understood about the afterlife from the Qur'an and hadith, people do not go to the final heaven or hell until after the entire world ends. Prior to that they spend their time in the barzakh.
There are parts of the barzakh which resemble heaven or hell and it seems that those who are confined in the more hell-like area would have less flexibility to visit to the living, as the opportunity to do so is sometimes said to be in proportion to one's faith. Perhaps they will lack the spiritual strength to do so, or perhaps they will be concerned with themselves, or perhaps they are kept away from other creations so as not to cause harm.