Assume I have to go from place A to B and bring something with me, but I don't know when it will be. I'll have to take the train, but I have a season ticket, so I don't specially need to buy one. I can basically step out the door and leave for B. How would an app work, that recognizes that now I'm leaving for B and then remind me that I should bring the item?
One thing that works pretty well for me is putting something on/in in something else I cannot leave without : wrap a list of things around your train ticket; lock the door from inside and put the key next to the object not to forget, put a thing in your shoes... Even better, as suggested by @papakias, you could stick a post-it on your smartphone.
I don't know how an app (or anything else) could know where I'm going when I step out the door, unless I tell it. That's why I create documents on my computer with titles like "Packing for a Trip". Each time I travel, I open up that file and use it as a reminder of what to put in my suitcase and toiletries bag.
Unfortunately, I think what you want is something that recognizes where you are going when you leave the house. If anyone can provide an answer that addresses that, I'll give them a big upvote!
The way I deal with similar cases, is by adding a periodic reminder. If the event is likely to happen in months, I set a monthly reminder (remember to pack x and y, if you are doing z this month). If it is possible to happen in weeks, I set a weekly reminder. Yes, sometimes the reminder is annoying, but it keeps me aware there are pending things to prepare/do before I carry out the action.
Fully automatic solutions require mindreading, and we're not that advanced yet. So there has to be a manual step.
At the start of each week, I create a plan for that week: what projects do I work on, do I need to travel anywhere? That would be a good moment to include the reminder "if I go to B, bring X".