In this paper we study the (nonlocal) torsional rigidity in the ambient space of random walk spaces. We get the relation of the (nonlocal) torsional rigidity of a set Ω with the spectral m-heat content of Ω, what gives rise to a complete description of the nonlocal torsional rigidity of Ω by using uniquely probability terms involving the set Ω; and recover the first eigenvalue of the nonlocal Laplacian with homogeneous Dirichlet boundary conditions by a limit formula using these probability term. For the random walk in R N associated with a non singular kernel, we get a nonlocal version of the Saint-Venant inequality, and, under rescaling we recover the classical Saint-Venant inequality. We study the nonlocal p-torsional rigidity and its relation with the nonlocal Cheeger constants. We also get a nonlocal version of the Pólya-Makai-type inequalities. We relate the torsional rigidity given here for weighted graphs with the torsional rigidity on metric graphs.