The main reason for this question is what most people tend to do when searching for a new job - don't let your boss know you are looking for another job until you have found it. Main reason is that the employer could find you a replacement faster than you might find a new job.
This would imply that the boss finds out you are searching for a new job, hire someone new, and then ... fire you based on what?
I can't really believe that searching for another job is a valid enough reason for an employer to fire an employee. Can the employer fire people without any valid reason? Does he have any consequences if he does so?
Assuming the employee is past his probation period. For the country I'm mostly interested in Germany, but would also like to know how its handled in other countries.