I think the writers often do it for an edited version to explain why they changed it if they already published it before bringing out a new version. But not every story has one. And most forewords are written about famous books by friends or otherwise close acquaintances as a kind of essay about what their friend's book means to them. Most of the forewords I've ever read, though, were at the front of great works of literature. If the author does initially write one, it's usually a disclaimer of some sort, and I can imagine the publisher makes them if they think it's going to be too edgy but they're taking a gamble or something. I dunno.
well in for example Laws of magic by Terry goodkind (i don't know if you are alloud to post names etc) he writes things like: thanks to whom and for them etc etc (mostly family)
The Foreword is generally written by someone other than the author. In contrast, a Preface is written by the author for approximately the same purpose.