A common shrub in Mediterranean sclerophyll scrubland (maquis, garrigue); also in dry woodland with Pinus spp., Carpinus betulus, Quercus ilex and other oaks, Quercus-Lentiscus scrub, as well as in montane and wetter forest with Cedrus libani, Pinus nigra, Juniperus foetidissima, and J. excelsa. The altitudinal range is 1-2,200 m a.s.l. It occurs on dry, stony slopes in thin soils over all kinds of rock from calcareous to siliceous and serpentine, but uncommonly on sand dunes; in pastures at higher altitudes it is usually a sign of overgrazing. It is largely restricted to regions with a Mediterranean climate, but in the Balkans and the Iberian Peninsula it may occur in more continental conditions. The subspecies badia and oxycedrus are tolerant of frost, unlike the subspecies macrocarpa and transtagana. The latter two are largely restricted to coastal dunes or old, vegetated beaches on sand, where they occur in open pine woods (Pinus halepensis, P. brutia, P. pinea) as well as in scrub (garrigue, maquis) or associated with coastal grasses.

Prickly Juniper is suitable for cultivation as an ornamental in southern Europe where a number of cultivars, especially with more pendulous foliage, are commonly planted in gardens and parks. Essential oils are extracted from the branches and leaves, especially in France and Turkey. This 'oil of cade' is used for medicinal purposes.