First of all, everything is perfectly grammatical.
1) Allen's friend bought a bag for his girlfriend on her birthday.
This is fine but it's ambiguous.
Is Allen's friend a man or a woman? Is the girlfriend Allen's girlfriend or (if Allen's friend is a man) Allen's friend's girlfriend?
For what it's worth, the first few times I read this, I interpreted it this way:
Allen's friend bought a bag for (Allen's friend's) girlfriend on her birthday.
I think this is the most natural interpretation. If it was meant to be otherwise, I would have rephrased it:
Allen's friend bought a bag for Allen's girlfriend on her birthday.
2) The next time he meets her, she has the same bag with her.
Since I interpreted his in the first sentence as referring to Allen's friend and not Allen, I can only interpret he here as referring to Allen.
Why? Because the following doesn't make intuitive sense to me:
The next time Allen's friend meets (Allen's friend's) girlfriend, she has the same bag with her.
If they are boyfriend and girlfriend, it's a little odd to read "the next time he meets her," something that would be reserved for a more casual and less permanent relationship.
Of course, if Allen's friend is a woman, then this second sentence could either be saying that Allen is meeting his friend—or that he's meeting his friend's girlfriend. (Her could refer to either one.)
Also, Allen is the only named character. It would typically be awkward for a narrative to include a series of (ambiguous) pronouns in the same group of sentences where a character is named—and not have any of those pronouns refer to the named character.
To rephrase this as an example, and apply my assumptions to the references:
Allen has a friend named John. John has a girlfriend named Nancy.
John bought a bag for Nancy on her birthday.
The next time Allen meets Nancy, she has the same bag with her.
Allen compliments the bag and asks Nancy, "Where did you buy the bag from?"
With these assumptions, and this interpretation, the flow is a little off. To me, Allen may or may not know about the bag that was John's birthday gift to Nancy. So, saying she has the same bag is referring to something that hasn't been established yet. (It hasn't been made clear that Allen does know about this bag or has seen it previously.)
Even using the interpretation you say is correct:
What's actually being said - "Allen's friend being as absent-minded as he is, forgot that he bought the bag as a gift for her."
The word same is out of place. It should just read "she has the bag with her."
Also, if they are boyfriend and girlfriend, I fall back on finding "the next time he meets her" as sounding odd. For people in a romantic relationship I would say "the next time he sees her" or "the next time they go out." Unless in the early stages of dating, you don't normally use the word meet to refer to getting together with your partner.
Regardless of any of this, in order to avoid this kind of confusion, all of the characters should be named. Or, if they aren't named, then pronouns need to be used in a way that is not open to interpretation.