Yes, this is a biological phenomenon, not a physical one, because the phenomenon depends on a cellular response. Pressing your eyeballs (mechanically stimulating them) causes you to see phosphenes.
What is the cause of this phenomenon?
The increased pressure in the eye causes activation and inhibition of cells in your retina (retinal ganglion cells). These cells are intermediates between the light-sensitive sensory neurons and the brain which interprets information into an image.
Quoting a well known study from 1989:
Eyeball deformation [pressing] in total darkness led to an activation of the
on-center ganglion cells, while the off-center ganglion cells were
inhibited. The latency and strength of this activation or inhibition
varied considerably between different neurons, but were fairly
constant in the same neuron when the eyeball indentation was repeated
after a pause of 1-3 min. The latency and strength of neuronal
activation or inhibition seemed to be dependent mainly upon the neuron
location relative to the point of eyeball indentation. Some on-center
neurons also exhibited a short activation at "deformation off". [...] We assume that the activation of on-center and inhibition of off-center ganglion cells by eyeball deformation are caused by retinal stretching, which also leads to horizontal cell stretch. Stretching the horizontal cell membrane probably generates an increase in membrane sodium conductivity and a depolarization of the membrane potential [neuron firing]. This depolarization of the horizontal cell membrane potential is transmitted either directly or indirectly (via receptor synapses) from the horizontal to the bipolar cells.
This is a phenomenon at the retina (periphery), i.e. not in the brain region associated with vision processing (occipital lobe). You can achieve the same visual effect by vigorously sneezing or blowing your nose, stimulating the same cells electrically (by injecting current with electrodes) or magnetically (with coils that generates a local magnetic flux, whereby currents are locally induced). It is also possible to duplicate the effect by stimulating only the visual cortex, but it is likely due to the fact you are simply approximately replicating the retinal firing patterns coming to the brain via the visual nerve.