Since the accepted answer is incorrect, here's some info about the originals. If anyone finds a source for how it works in the remakes, feel free to edit my answer.
Yes, at least in the original DP games, the berry can despawn but this will take multiple days.
As with Generation III, when a plant is fully grown, the player has an amount of time equal to the full growth time of the plant to pick the Berry; after this time, the plant will return to its sprouting stage. This regrowth can occur up to 9 times (for a total of 10 plantings) before the plant is permanently lost. If Stable Mulch was used before the Berry was planted, the Berry will remain harvestable for 50% longer. If Gooey Mulch was used before the Berry was planted, the plant will regrow 14 times (for a total of 15) before being permanently lost.
If you want to be sure you won't lose access to a berry completely, make sure you always keep at least one in your bag.