Dr Mahathir Mohamad said he had wanted to see Anwar Ibrahim to thank the jailed former Opposition leader for supporting his PM candidacy. I think the real reason the meeting didn't happen is because Anwar himself didn't want Mahathir as a visitor. As Dr MiM suggests here, Anwar wouldn't want to be seen as subservient to Mahathir. Anwar would make sure he has total control over the outcome of any meeting with Mahathir. Anwar fully realises that Mahathir does not have any bargaining power here.
The official reason, meanwhile, is simply that Mahathir didn't write in to the authorities to request visiting rights. Even YB Nurul Izzah, Anwar's daughter, has confirmed it, h e r e and you could see she wasn't particularly upset about the whole incident.
YB Salleh Said Keruak told Mahathir even a convict's wife needs to formally apply to visit. "There are laws and procedures. As the Pakatan Harapan's PM-candidate, he should be the first to lead by example and not abuse his power or break the law. By doing so, he's only teaching the Malaysian people that if you are someone you don't have to abide by the law." (Perdana Menteri pun perlu mengikut undang-undang).