'Sanctuary city' is an informal and unofficial term used in the USA and Canada to refer to a municipality which has lax enforcement of the laws relating to illegal immigration.
It may simply refer a city that has an official policy directing law enforcement officers to not ask for proof of citizenship; this was the initial meaning, as used by Los Angeles when they adopted this policy in 1979.
"Officers shall not initiate police action with the objective of discovering the alien status of a person. Officers shall not arrest nor book persons for violation of title 8, section 1325 of the United States Immigration code (Illegal Entry)."
Los Angeles Special Order 40, November 27, 1979
Currently, you are more likely to hear the term used in reference to a city that refuses to cooperate with the federal government in policing illegal immigration. This may take two forms:
First, the Illegal Immigration Reform and Immigrant Responsibility Act of 1996 requires that local agencies do not withhold information on immigration status from the federal government. This is tricky, because if the official policy of the local municipality is to not collect this information in the first place, then they can quite honestly say that they are not withholding any information, while still making the feds unhappy.
Second, some cities actively ignore requests from the federal government to detain specific people suspected of being illegal immigrants. The U.S. Immigration and Customs Enforcement (ICE) will often ask a local municipality to detain people that the ICE identifies as likely unauthorized immigrants. This "detainer request" is of questionable legality -- it is simply a written request from the ICE that an individual be held for "an additional 48 hours (excluding weekends and holidays) after his or her release date in order to provide ICE agents extra time to decide whether to take the individual into federal custody for removal purposes" (ACLU.org). However, holding someone without due process is technically illegal, and has been declared so in federal district court. However, most municipalities will honor these requests if accompanied by an appropriate court order.
Meanwhile, the United Kingdom and Ireland use the term sanctuary city to refer to a city that is dedicated to supporting immigrants. No tricky legal shenanigans are implied or required.