Good, useful and unique content and a sense of community. Once people make friends they are less likely to leave.
Many people, most probably just read forums and never even register so just getting people to register and post for a bit is a major part of the battle.