Joints occur pretty much everywhere in rocks exposed at the surface of the Earth. And they can be pretty important, both during construction activities, intrusion of magma and flow of fluids (groundwater, hydrocarbons, CO2, magma). Joints represent conduits of fluids, particularly in the vertical direction, and are made artificially during fracking (hydraulic fracturing) operations.
Joints form naturally in a variety of settings, but particularly during exhumation due to pressure release and cooling. Thermal contraction is very important, and it is the stiff layers that fracture most easily. Hence we typically see fractured sandstone or limestone layers between non-fractured or less fractured siltstones or shale layers. Layers that develop different joint patterns define what is called mechanical stratigraphy.
Typically, stiff layers develop fractures with a characteristic spacing that depends on layer thickness: The thicker the layer, the farther apart the fractures, as shown in some of these pictures.