Creatures can't attack you unless their controller pays for each creature they control that's attacking you.
Ghostly Prison is a cornerstone pillowfort enchantment that taxes attackers without stopping them outright. The beauty in Commander is the multiplayer math: making opponents pay per attacker means swinging at you with a wide board costs them a fortune, so they naturally redirect aggression toward easier targets.
It shines in slow, grindy decks that need time to set up — superfriends/planeswalker shells, control decks, big-mana ramp strategies, and anything that wants to win on a long axis (Azorius/Mono-White control, group-slug, or combo decks that need a turn or two of safety). Pairs beautifully with Propaganda, Sphere of Safety, and Windborn Muse to stack taxes.
Don't play it in aggressive decks where you're the one attacking — it does nothing offensively and can make you look passive while the table ignores you. It's also weak against go-tall threats (one 20/20 still only costs ) and useless versus burn, mill, or noncombat damage. Best when paired with other deterrents, not as a standalone.
Unless some effect explicitly says otherwise, a creature that can't attack you can still attack a planeswalker you control.
In the Two-Headed Giant format, you still only have to pay once per creature.