Context. The main driving forces supplying energy to the interstellar medium (ISM) are supernova explosions and stellar winds. Such localized sources are assimilable to curl-free velocity fields as a first approximation. They need to be combined with other physical processes to replicate real galactic environments, such as the presence of turbulence and a dynamo-sustained magnetic field in the ISM. Aims. This work is focused on the effect of an irrotational forcing on a magnetized flow in the presence of rotation, baroclinicity, shear, or a combination of any of the three. It follows an earlier analysis with a similar focus, namely, subsonic spherical expansion waves in hydrodynamic simulations. By including magnetic field in the model, we can evaluate the occurrence of dynamo on both small and large scales. We aim to identify the minimum ingredients needed to trigger a dynamo instability as well as the relation between dynamo and the growth of vorticity. Methods. We used the Pencil code to run resistive magnetohydrodynamic direct numerical simulations, exploring the ranges of values of several physical and numerical parameters of interest. We explored Reynolds numbers up to a few hundreds. We analyzed the temporal evolution of vorticity, kinetic, and magnetic energy, as well as their features in Fourier space. Results. We report the absence of a small-scale dynamo in all cases where only rotation is included, regardless of the given equation of state and rotation rate. Conversely, the inclusion of a background sinusoidal shearing profile leads to an hydrodynamic instability that produces an exponential growth of the vorticity at all scales, starting from small ones. This is know as vorticity dynamo. The onset of this instability occurs after a rather long temporal evolution of several thousand turbulent turnover times. The vorticity dynamo in turn drives an exponential growth of the magnetic field, first at small scales, followed by large ones. The instability is then saturated and the magnetic field approximately reaches equipartition with the turbulent kinetic energy. During the saturation phase, we can observe a winding of the magnetic field in the direction of the shearing flow. By varying the intensity of the shear, we see that the growth rates of this instability change. The inclusion of the baroclinic term has the main effect of delaying the onset of the vorticity dynamo, but then leads to a more rapid growth. Conclusions. Our work demonstrates how even purely irrotational forcing may lead to dynamo action in the presence of shear, thus amplifying the field to an equipartition level. At the same time, we confirm that purely irrotational forcing alone does not lead to any growth in terms of the vorticity, nor the magnetic field. This picture does not change in the presence of rotation or baroclinicity, at least up to a resolution of 2563 mesh points. To further generalize such a conclusion, we will need to explore how this setup works both at higher magnetic Reynolds numbers and with different prescriptions of the irrotational forcing.