Label her house $0$, the position of the florist $F$, the point where she stopped $S$, and the position of the hospital $H$.
She walked $S$, stopped, walked $S-F$, bought flowers, then walked $H-F$ to get to the hospital. Finally she walked $H$ to get home. That makes a total of
$S+(S-F)+(H-F)+H$
$=2S + 2H - 2F$
From the information in the question, we know that $S = 500$ and $H-F = 800$, so that gives
$1000 + 1600 = 2600$ total.
The apparently counterintuitive nature of the question is that it seems like we need to know how far she wasted retracing her steps between where she stopped and where the florist was. But note that the distance from the hospital to the florist is fixed. So the further she had to retrace her steps, the shorter we know her total journey was in the first place.
For example, if she only just passed the florist when she remembered, the total distance between house and hospital would be 1300m. If the florist was right next to her house and she had to trapse all the way back home to get those flowers, then the total distance between house and hospital would only be 800m.
So the distance between house and hospital decreases by exactly the wasted distance. The wasted distance is walked twice as a result of the waste (walking from the stopping point back to the florist, then getting back from the florist to the stoppoing point again), but the full journey is also walked twice, so the two even out.