"The LORD also spoke to Joshua, saying, 'Speak to the children of Israel, saying, 'Appoint for yourselves cities of refuge, of which I spoke to you through Moses, that the slayer who kills a person accidentally or unintentionally may flee there; and they shall be your refuge from the avenger of blood. And when he flees to one of those cities, and stands at the entrance of the gate of the city, and declares his case in the hearing of the elders of that city, they shall take him into the city as one of them, and give him a place, that he may dwell among them. Then if the avenger of blood pursues him, they shall not deliver the slayer into his hand, because he struck his neighbor unintentionally, but did not hate him beforehand. And he shall dwell in that city until he stands before the congregation for judgment, and until the death of the one who is high priest in those days. Then the slayer may return and come to his own city and his own house, to the city from which he fled'" (Josh. 20:1-6).
Moses was given detailed instructions pertaining to this subject in Number 35 and Deuteronomy 19. Although the Levites were not given large blocks of land as the other tribes received, God did want them to have a number of cities--48 in all--scattered throughout Canaan (cf. Gen. 49:7). Each tribe would give some of their cities to the Levites, along with common land surrounding it. The Levites were typically the most knowledgeable when it came to religion and spiritual matters. Thus, having them dwell throughout the land would maximize their influence for good among the nation, instead of having them all dwell in one region where their interactions with others might be more limited.
Of the 48 cities, 6 were to be used for a very special purpose. They were to be cities of refuge. Under the Mosaic law, if person X killed person Y, then the nearest of kin to the deceased (person Z) had the duty to seek vengeance. He would function as the "avenger of blood" on behalf of the one who had been slain. Remember, their basic rule of law was "an eye for eye," etc. (cf. Exo. 21:12ff). It was the duty of person X to flee to one of these cities of refuge for protection until a judgment was rendered. These cities were scattered throughout the land (3 on each side of the Jordan) so that wherever one was in the Promised Land, he could travel to a place of safety fairly quickly.
After the slayer sought refuge in one of these cities, he was protected--at least until he had his day in court, so to speak. If he was found guilty of murder (i.e., premeditated killing based on hatred), then he would be put to death. Under the Old Law, convicted murderers must die--period! This ruling required at least two witnesses to the crime. If the slayer took a life accidentally (e.g., if an ax head came off the handle while chopping wood and it struck a person; cf. Deut. 19:5), then his life was safe as long as he remained in the city of refuge. If he left the city (for whatever reason), the avenger of blood could justifiably take his life. The only exception to this was that whenever the high priest died, the manslayer's record would be wiped clean, in a manner of speaking. He could go home and the avenger of blood was not permitted to harm him. There were no other exceptions.
Obviously, God takes the loss of innocent human life seriously and set forth these rules for protection of it. Even accidental killings were not treated trivially. The one who carelessly slaughtered another would have to remain in a city of refuge (likely for years and perhaps even for many decades). Manslaughter would radically change his life (as it also did for the victim's family who lost a loved one).
There is one interesting matter of typology that can be detailed here. As Christians, our High Priest (Jesus) never dies! Therefore, we-who, on our own merits, have hands stained with sin and are worthy of death--must always remain in our place of refuge (i.e., "in Christ"; Rom. 8:1). Our sins will not be cleansed with the passage of time if we are outside of Christ (i.e., outside the place of refuge). If we leave Christ and the spiritual safety He provides, we will eventually perish and be without hope.