Yes there are ways a country can find out where you have been. But country A will not tell country B and so on. That has all sorts of privacy and security issues. The most obvious way is to look through a passport for stamps and that is about the only thing available to an immigration officer at the desk. In the case of Israel they used to allow you to get the entry/exit stamp on a bit of paper instead of in your passport to avoid problems with other countries. If you do try to hide your travel history to avoid things like quarantine then as alex_b rightly says the consequences of getting caught could be severe (prison, fine, barred future entry etc).