We consider the effects on phonon dynamics of spin-lattice coupling within the slave-boson mean-field treatment of the extended $t$-$J$ model. With no additional assumptions the theory is found to give a semi-quantitative account of the frequency and linewidth anomalies observed by Raman and neutron scattering for the 340$cm^{-1}$ $B_{1g}$ phonon mode in $YBa_2Cu_3O_7$ at the superconducting transition. We discuss the applicability of the model to phonon modes of different symmetries, and report a connection to spin-gap features observed in underdoped YBCO. The results suggest the possibility of a unified understanding of the anomalies in transport, magnetic and lattice properties.