I would say registering an account may be required from the forums maintainer because they collect some information like emails, for example, or some other information. In other cases, like dating or meeting forums, for example, there could be a goal in contacting other forums members privately, which is impossible if they do not have a special account.
Besides that, all forums communication may be done between guest members (like miniBB offers by default). Just a simple registration is posibly bad method of preventing of spam, because it is very simple to write a program which logs in and spams like it would be a regular user. Possibly "
CAPTCHA" algorithm is the most efficient nowadays against recognizing human and a bot.