How and why does Allah seal people's hearts?
From the Quran it appears that once a person crosses a certain line of evil, God blocks them from coming back to the good side.
When a person dies, their fate is sealed, they can no longer repent and do good deeds to change their fate. It appears that when a person commits certain acts of evil, it is as if they have died. One such act is premeditated murder, which “rips the soul apart” (as it is described by some people) so that it cannot be made whole again, and the person who commits it becomes irreparably evil and broken.
This does not happen by accident. A person has to make evil choices day in and day out for years on end, until the point of no return is reached. Murder is not an ordinary crime, a person has to be already really evil to commit it, and committing it puts them beyond the point of no return so that their hearts are sealed and they are not allowed to return to the good side again.