If so, what were the circumstances?
Yes. The Portuguese Royal Family were evacuated from Portugal to Brazil when the French invaded in 1808, and stayed there until the early 1820's.