There are tons of reasons for this. Since you said any government is welcome, my examples will mostly be in the U.S. where I am.
I'm not familiar with how it's used in Slovakia, but, in most countries, your government-issued ID is for, well, identification purposes. That is, it's supposed to be one of the things that other sources (including even application for other forms of ID) can check to verify your identity... including where you live. It wouldn't be fit for this purpose if you could just state whatever you want with no verification for where you live.
Voting, as you mentioned, is a big one. Especially here in the U.S. where we have a federal system and even voting for President and members of Congress is by state. By not verifying which state (and even Congressional district) you live in, you could vote in more contentious states/districts rather than the one you're really supposed to vote in or even vote in more than one district/state.
Taxes and Fees
Tax rules and rates often vary dramatically by location. This is especially true from one country to another, but also can be very much the case within a country or even within a state/province. For example, sales taxes here in the U.S. vary significantly by state and even municipality (city/county,) as do income taxes, wheel taxes (taxes on registered vehicles) and, of course, property taxes. My state, for example, has no state-level income tax on personal income. In most states, it's a few to several percent of your income. Lying about where you live could potentially save you thousands of dollars annually on taxes (or potentially much more if you earn/spend a lot of money.)
Fees can also vary quite dramatically depending on where you live. Where I live, registering a vehicle costs a $25 annual fee. In many other states, it's hundreds.
Employment Law Compliance
Most countries have some form of residency/immigration status requirement for employment. Your ID card wouldn't be useful for providing evidence of this if they didn't verify where you live.
ID cards are sometimes valid forms of ID for crossing borders. For example, the driver's licenses of certain U.S. states are valid ID for admission to Canada across land borders. (Driver's licenses are the primary form of "ID card" here in the U.S.) Obviously, immigration requirements are almost always specific to where you live, at least to the level of confirming your nationality.
One important reason why the U.S. government wants to know where people live is to have accurate census information for the populations in each area. This information is, in turn, used for all sorts of important reasons, ranging from allocation of members of the U.S. House of Representatives, state legislatures, and county/city government officials to population-based allocation of federal and state funding for things like education and infrastructure to just having accurate information to publish as an authoritative source of populations for use by others (both other government agencies for purposes like producing accurate statistics by demographic as well as by the public at large for research, statistics, etc.)