By using ab initio electronic structure calculations within density functional theory, we study the structural, electronic, and magnetic properties of Si doped with a transition metal impurity. We consider the transition metals of the 3d series V, Cr, Mn, Fe, Co, and Ni. To get insight into the level filling mechanism and the magnetization saturation, we first investigate the transition metal-Si alloys in the zinc-blende structure. Next, we investigate the doping of bulk Si with a transition metal atom, in which it occupies the substitutional site, the interstitial site with tetrahedral symmetry, and the interstitial site with hexagonal symmetry. It is found that all of these transition metal impurities prefer an interstitial position in Si. Furthermore, we show that it is possible to interpret the electronic and magnetic properties by using a simple level filling picture and a comparison is made to Ge doped with the same transition metal atoms. In order to get insight into the effect of a strained environment, we calculate the formation energy as a function of an applied homogeneous pressure and we show that an applied pressure can stabilize the substitutional position of transition metal impurities in Si. Finally, the energies of the ferromagnetic states are compared to those of the antiferromagnetic states. It is shown that the interstitial site of the Mn dopant helps us to stabilize the nearest neighbor substitutional site to realize the ferromagnetic state. For doping of Si with Cr, a ferrimagnetic behavior is predicted.