There were about 2,000 black people in California within four years of the discovery of gold. Many black people from northern states were drawn to California to strike it rich so they could buy their freedom for themselves and their families.
Some slave owners sent their slaves off to the mine fields to find gold for their masters. The owners felt they would come back because they wouldn't leave their wives and children behind. Occasionally these slave owners came to California themselves and brought their slave staffs with them as servants and to work the mines.
In 1850, California was granted statehood and declared a "free" state. This made California a place for both freed and escaped slaves because it was so far from the rest of the country.
Read about other people associated with the Gold Rush: