Mania errabunda or restless madness is the tendency of senile people (usually elderly) to wander aimlessly away from home. The name is not much used in the 21st century. The term is also used in conjunction with drug abuse and alcoholism.
In fiction
Sir Walter Scott's The Fair Maid of Perth. Browne says that the flight of Conacher is similar.