Do Berry Trees last until harvested?
I'm playing Shining Pearl and I can plant Berry Trees to make more berries. I have gaps in my playtime, so I'm worried that if I plant a berry it will despawn and I'll lose my rare berry.
If I plant a berry and leave it will it stay there for me to pick it or do I have to go and gather it before it despawns?
Berries are eternal, as they always have been (except XY berry fields where bushes wither after a month).
(Source: A berry I planted on release day is still there.)
Just go around, pick and replant berries as you go through plots. Once you unlock the whole map you can start doing farming loops around the world.
However, Honey Trees need to be checked every day.
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.
Bulbapedia
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.