To quote the key points of an easy to read publication by Salgado and Vargas-Hernández (doi 10.4236/ajac.2014.517135, open access):
All starts with the dissociation equilibrium between the acid $\ce{HA}$ and its anion $\ce{A-}$ for which you write
$$\ce{HA + H2O <=> H3O+ + A-}$$
By consequence of this, the recorded total absorbance $A_\mathrm{t}$ for system, assuming only the acid and its anion absorb light in the region inspected, equates to
$$A_\mathrm{t} = d(c_{\ce{HA}} \cdot \varepsilon_\ce{HA} + c_\ce{A-} \cdot \varepsilon_\ce{A-}) = d \cdot c_\mathrm{t} \cdot \varepsilon_\mathrm{t}$$
with $c_\mathrm{t}$ as total concentration; $\varepsilon$, the absorption coefficient; and $d$, the optical path length.
For one, you record a spectrum at low pH to convert all of your sample into the acid form ($c_\mathrm{t} = c_\mathrm{HA}$, and $c_\ce{A^-} = 0$) where all absorption is due to the acid. Equally, you record a spectrum at a pH this high that all or your sample is deprotonated (then $c_\mathrm{t} = c_\mathrm{A^-}$). You need then spectra between the two extrema, with some of $\ce{HA}$ in presence of some of $\ce{A-}$, because the proportion of the concentrations of acid to its anion may be expressed by
$$\frac{c_\ce{A-}}{c_\ce{HA}} = \frac{[\ce{A-}]}{[\ce{HA}]} = \frac{A_\mathrm{t} - A_\ce{HA}}{A_\ce{A-} - A_\mathrm{t}}$$
This is why you search for the isobestic point, where the absorption spectra recorded do not vary while varying the pH value of your analyte, and where $\varepsilon_\ce{HA} = \varepsilon_\ce{A^-}$.

(credit: doi 10.4236/ajac.2014.517135)
Because the equilibrium between the acid and its anion may be described by
$$\log{K_\mathrm{a}} = \log[\ce{H3O+}] + \log{\frac{[\ce{A^-}]} {[\ce{HA}]}} $$
and the definition of $pK_\mathrm{a} = - \log{K_\mathrm{a}}$ you may substitute absorptions by concentrations to yield
$$\log{\left(\frac{A_\mathrm{t} - A_\ce{HA}} {A_\ce{A-} - A_\mathrm{t}}\right)} = \mathrm{pH} - pK_\mathrm{a} $$
Hence, plotting $\log{\left(\frac{A_\mathrm{t} - A_\ce{HA}} {A_\ce{A-} - A_\mathrm{t}}\right)}$ in function of $\mathrm{pH}$ yields a slope with an intercept of $y = - pK_\mathrm{a}$.

(credit: loc. cit.)
Addition:
With WebPlotDigitizer it was possible to convert above mentioned figure 8 into numbers, separate for the basic (b), the acidic (a) and the intermediate / about neuter run at pH = 7.7 (n). (The result, a .csv file, is deposit here.) For a wavelength of about $550\,\mathrm{nm}$ the readout of Abs equals to 1.9935 (b), 0.6502 (n) and 0.2241 (a), and the computation
$$ pK_\mathrm{a} = 7.7 - \log_{10}{\frac {0.4534 - 0.2984} {1.2121 - 0.4534}} $$
$$ pK_\mathrm{a} = 7.7 - \log_{10}{\frac {0.1550} {0.7587}} $$
$$ pK_\mathrm{a} (550\,\mathrm{nm}) = 8.39 $$
By similar token, $pK_\mathrm{a} (604\,\mathrm{nm}) = 8.20$ (with Abs of 1.9935 (b), 0.6502 (n), and 0.2241 (a)); or $pK_\mathrm{a} (432\,\mathrm{nm}) = 8.51$ (with Abs of 0.3411 (b), 0.8198 (n), and 0.8940 (a)).
To put this into perspectivive, the arithmetical mean of the four methods compared in Salgado's paper equals to $pK_\mathrm{a} = 8.277$. Possibly, the difference between their result and the «recuperation» here were smaller if either a) WebPlotDigitizer were used with a lesser data increment, b) using an interpolation / smoothing function among the data extracted by the program, c) figure 7 were reconstructed from their figure 4.