I'll say hot take here, but I'm not sure this is the right solution, or at least it should be decided on a case by case basis and depends on how unsafe it is. They should be removed from society for a time absolutely, but not prison.
Stalking is a mental health issue, a fascination and obsession. I think it warrants being put into a mental health institution for rehabilitation. Prison isn't going to help, it just removes the problem, but rehabilitation might