COnly if the temperature is kept constant
c
$P = K \rho$
From ideal gas law we know,
$PV = nRT =\frac{ m }{ M _{0}} RT$
$\Longrightarrow PM _{0}=\rho RT$
$\Rightarrow P =\left(\frac{ RT }{ M _{0}}\right) \rho$
$\text { Thus } K =\frac{ RT }{ M _{0}}$
Hence temperature is constant for Boyle's law to hold true.