The earths crust is divided into several tectonic plates (shown below) that have over time moved across the surface of the earth. Beneath the ocean basins there is a layer of dense basalt, in some places less than 3-miles thick, which makes up these plates, whereas the land masses (i.e., continental crust) are made up of a layer of less dense granitic material, up to 20-miles thick, that, in essence, "floats" on a thin underlying layer of oceanic crust. The west coast of is in fact a plate boundary that separates oceanic crust to the west from continental crust to the east. The oceanic plate to the west is the Pacific Plate, although in the geologic past there was another ocean plate to the west called the Farallon plate, and the plate to the east is the continent of North America. The map below shows the present day plate boundaries.
During the Mesozoic Age, more than 65 million years ago when dinosaurs walked the earth, the Farallon plate (which preceded the Pacific Plate) and the North American plate were moving towards each other, with dense oceanic crust (basalt) of the Farallon plate diving beneath the more bouyant continental crust (granite) of North America. This process, which is called subduction, is shown below.
Subduction zones are represented by deep ocean trenches, like the modern trenches off the coast of Alaska and South America. A similar trench once existed off ths coast of California. When subduction takes place, frictional heating caused by one plate diving beneath another can generate enough heat for volcanoes to form and result in a curved chain of volcanoes called and arc.
A volcanic arc did indeed develop to the east of the Farallon-North American subduction zone, and created an ancient mountain range that preceded the modern Sierra Nevadas. As the Farallon plate pushed against North America, compressive forces created the Coast Ranges of California and pushed them up and over the San Joaquin Valley.
Compressive forces also tilted the Sierra Nevada volcanic arc on the far side of the valley so that the arc sloped towards the west. Then both the crest of the Coast Ranges, and the volcanic cover of the Sierran Nevadas were then eroded off to fill in the San Joaquin Valley with sediment, and the valley, which had been an inland sea up to this point, became a landlocked basin. Tilting of the Sierras also exposed the granitic roots beneath the volcanaoes to create the Sierran landscape we know today.
Subduction continued into the Tertiary (the Age of Mammals), when most of the Farallon plate got pushed beneath North America, and the East Pacific rise, which separated the Farallon and Pacific plates, collided with North America. This caused subduction to stop and the plate boundary off the coast of California was was transformed from a trench into the modern San Andreas Fault, which is a zone of right-lateral strike-slip motion that is breaking off the costal region of California and moving it north towards Alaska. This transformation is shown below in a series of geologic snapshots beginning about 40 million years ago.
snapshots of the evolution of California from one of Tanya Atwaters Plate Tectonics animations
One of the consequences of the above sequence of events is the creation of two triple junctions - the Mendocino in the north and the Rivera in the south. The Mendocino triple juction represents where the Medocino fracture, a zone of right-lateral slip, joins the San Andreas fault and the Cascadia trench. The Rivera (which is south of our map) is where right-lateral faults in the Gulf of California meet another ocean fracture zone and the spreading center represented by the mid-Pacific Rise (where two ocean plates are separating). Basically, these two triple junctions move apart with time, and the San Andreas fault grows between them.
TRY THESE LINKS FOR MORE INFO
Plate tectonics of course is a global process, and the images below show how the continents have moved over time. Note how the west coast of North America, in other words the California margin, has always been bordered by an ocean.