We mentioned previously that the Sages of the Anshei Keneseth Haggedolah instituted a Birkath Hoda-ah (blessing of thanksgiving) for four categories of people. One who was ill in bed for three days and was cured, one who was imprisoned and released, one who travelled by sea and one who travelled over the desert and reached his destination.
The reason for reciting a blessing is that people tend to forget that they were saved from the dangers inherent in these four cases, because of Divine Intervention, but they explain it as being the normal course of nature. Since, in a person's mind, it is normal to arrive safely at your destination after a long journey, or to be released from prison after being incarcerated, or to recover after an illness, we forget that G-d is the One who is overseeing everything. Reciting the blessing is a reminder to us.
(See Ben Ish Hai, Shanah Aleph, Parashath 'Eqeb, Haqdamah and Oth Aleph)