There's nothing wrong with writing for free if that's what you want to do, but there's a few things you need to know before you agree to do this. This advice applies to writing free short stories, novellas, and novels, not to blog posts. That is a totally different topic.
1.) Don't Do It If The Person Doesn't Make You Sign A Contract
This should be a huge red flag for you. If they don't make you sign a contract, they don't know what they are doing. It doesn't matter if the person is one of your author friends or an actual publishing company, there should always be a contract.
Because it establishes a communication about expectations. It makes sure everyone understands what is going to happen and there are no disagreements over it. It protects both parties.
We tend to think of contracts as something you use to negotiate money and when you write a short story for free, there is no money involved. So when there is no contract, it's easy to shrug it off.
I've done this three times. Two out of the three, I was given a contract to sign. The other one, there was no contract and I still feel like that one was a mistake. I'm happy about the other two.
The person I didn't sign a contract with did zero editing of my story. The other two had editors that worked on it. The person I didn't sign a contract with was rude to me as soon as I agreed to let her use my story. The other two were very polite and professional. The person I didn't sign a contract with didn't give me a free copy of the book, she made me purchase it. The other two gave me copies of the book and one of them even signed it with a very nice note!
A contract is the difference between a professional and an amateur. It doesn't matter if you've known each other for years and you are best friends, draw up a contract anyway. You need to iron out all those details. It doesn't make you any less of good friends.
2.) Your Name Will Be Hard To Find
Unless you are a NYT Bestselling author and they are trying to sell more copies using your name, your name will probably be hard to find. It's unlikely that it will be on the cover. It will probably only be in the blurb and right next to your story title inside the book.
This might disappoint some authors, especially if it's the first thing they ever published, so I just thought I'd warn you.
The exception to this rule is if you are a part of an anthology of novels. Usually only a handful of people are part of something like this, so there's enough space for everyone's names.
3.) Do It For Fun Or Experience, Not Exposure
The last short story I submitted to an anthology, I did it because I wanted my story included with the kind of authors that published with that place and because I wanted to see a story of mine in print for the first time.
I don't know if publishing with them gave me any sort of exposure, but it doesn't matter. It's nice to see my name on something other than an ebook.
It's next to impossible to measure a word like "exposure", so people can promise you this and it doesn't really mean anything. So ignore that. Take it out of the picture and try to figure out if you're doing it for any other reason.
If it's just for exposure, just so your other books will sell well, then you are likely to feel resentful and disappointed when an anthology doesn't make you suddenly a NYT Bestselling author.
I will admit, I've met one exception to this rule. There is one author I know of whose first bestseller was an anthology, but that's not the case for most of us.
It's unlikely that anyone will remember you wrote for the anthology, even people who are fans of your books and read them regularly. Most people think I've published nothing in the last three years and that isn't even true. I've published a few short stories, but no one noticed it because my names aren't on the covers and I can't tag my author profile on Amazon to the books.
That's why you really need to make sure you are doing this for the right reasons. It takes time out of your life, time you could be using to gain exposure in other ways.