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".
There needs to be another way to recognize the event happening in order for anything to occur on a device. For example, will someone call you and tell you to leave in 5 minutes? Use a generic task/notify app to send a notification when you get a call from that number. Use it to notify it when you get an email on another program, when you pass a certian location, or whatever way that you know you are going to be going there. If you will go there some day after you leave a job or school or classs, then set the notification to occur at the time or location of leaving that daily or weekly event. Otherwise, you will have to put something like "Remind me once every theee days at 2pm" until you know the time of this travel trip... Or until you know what another digital or location-based event will be required to happen first, that you can now put into that generic app.