The scriptures forbid consulting mediums. It does not forbid speaking to the dead. Jesus did it. He spoke to Elijah and Moses.
So if God brings Samuel up for one final rebuke, what's the problem?
Deu 18:10 There shall not be found among you anyone who burns his son or his daughter as an offering, anyone who practices divination or tells fortunes or interprets omens, or a sorcerer
Deu 18:11 or a charmer or a medium or a wizard or a necromancer,
Deu 18:12 for whoever does these things is an abomination to the LORD. And because of these abominations the LORD your God is driving them out before you.