Rapidly rotating stars show short-period oscillations in magnetic activity and polar appearance of starspots. The aim of this paper is to study large-scale shallow water waves in the tachoclines of rapidly rotating stars and their connection to the periodicity and the formation of starspots at high latitudes. Shallow-water magnetohydrodynamic equations were used to study the dynamics of large-scale waves at the rapidly rotating stellar tachoclines in the presence of toroidal magnetic field. Dispersion relations and latitudinal distribution of wave modes were derived. We found that low-frequency magnetic Rossby waves tend to be located at poles, but high-frequency magnetic Poincare waves are concentrated near the equator in rapidly rotating stars. These results have important implications for the evolution of the stellar wind in young Sun-like stars. Unstable magnetic Rossby waves may lead to the local enhancement of magnetic flux at high latitudes of tachoclines in rapidly rotating stars. The enhanced magnetic flux may rise upwards owing to the magnetic buoyancy in the form of tubes and appear as starspots at polar regions. Magnetic Rossby waves may also cause observed short-term periodicity in the stellar magnetic activity.