Recent observations have revealed that the time-evolution of the S0 number fraction at intermediate and high redshifts (0.2 < z < 0.8) is more dramatic in groups of galaxies than in clusters. In order to understand the origin of S0s in groups, we investigate numerically the morphological transformation of spirals into S0s through group-related physical processes. Our chemodynamical simulations show that spirals in group environments can be strongly influenced by repetitive slow encounters with group member galaxies so that those with thin discs and prominent spiral arm structures can be transformed into S0s with thick discs and without any prominent spiral arm structure. Such tidal interactions can also trigger repetitive starbursts within the bulges of spirals and consequently increase significantly the masses of their bulges. Owing to the rapid consumption of gas initially in spirals during the bulge growth, the S0s can become gas-poor. The S0s transformed from spirals in this way have young and metal-rich stellar populations in the inner regions of their bulges. The simulated S0s have lower maximum rotational velocities and flatter radial line-of-sight velocity dispersion profiles in comparison to their progenitor spirals. The formation processes of S0s due to tidal interactions depend not only on the masses and orbits of the progenitor spirals, but also on the group mass. A significant fraction (10-30 per cent) of stars and gas can be stripped during this spiral to S0 morphological transformation so that intragroup stars and gas can be formed. Based on these results, we discuss structures, kinematics, chemical properties and the Tully-Fisher relation of S0s in groups.