Overall, my answer to the question of whether you can be friends with people who are in different life stages is a resounding YES! However, the chances of a friendship surviving changing life stages depends on what the friendship is based on to begin with.
Do you simply enjoy partying together? Shopping and getting your nails done? Or do you actually care about this person's life? Their feelings and thoughts and emotions? Do you 'get' each other? To put it bluntly, are you friends with this person because you like having another body to hang out with as you go about your life OR are you friends because you care about them and their life too? If they're simply your hang-out buddy, your friendship will likely fade when they can no longer hang out with you in the same way that they've been able to in the past.
Friendship requires both parties to make an effort
This is pretty self-explanatory, I think. Friendship is a two-way street. If one person wants the friendship to work and makes all the effort, they'll constantly feel rejected, under-appreciated, and insecure. That's really not a friendship, is it?
It requires patience
Often, when someone undergoes a major life transition (like having a baby) it affects everything in their life. They're more tired, they're more stressed, and often they're more self-focused as they try to cope with so many new experiences. If you're friends with someone who is in a transition, be patient. You might not realise it but let me tell you, they are in SURVIVAL MODE. It might seem like your friend isn't making an effort right now, but bear in mind that this is temporary. Wait around and love them in the best way that you can while they figure stuff out. If things don't get better over time, consider having an open conversation to discuss both your hopes and expectations for the friendship. And if that doesn't go well, maybe this relationship wasn't meant to last.
It requires some major understanding and empathy
When someone is in a different life stage to you, understanding their feelings, emotions, and needs might not come naturally. Because, after all, you really have no idea what it feels like to have a kid or to be married or to live in 'X' city because you haven't done it before. So use your imagination. Think about how you would feel in their position. And most importantly, try to give them the benefit of the doubt. If they hurt your feelings, remember that they probably didn't intend to do so. If they don't text you back, assume that they read the text in the middle of a hectic day, passed out that night before they could respond, and simply (in the midst of chaos) forgot about your text the next day.
It requires selflessness
After you start to understand where your friend is coming from, you'll be able to make some sacrifices. You'll understand that they truly can't leave the house in the afternoon because the kids are napping. Maybe you'll offer to drive to them so you can still see each other. Or maybe you know what they really need is to run some errands while the kids sleep, so you offer to babysit ... or run the errands.