A temporary ban is useful if you want/need to stop someone doing something immediately. It gets theretheir attention and allows you to hold a conversation with them about their behaviour and what they need to do once the ban is lifted.
Obviously, if they continue with the inappropriate behaviour once the ban is lifted a longer or even permanent ban can be issued.
In some cases it could be that the account has been compromised - either by someone leaving themselves logged in on a public computer, or (more seriously) by having their login credentials compromised. A temporary ban is usually enough to get the interloper off the site and give the account owner time to sort out the problem.