We investigate magnetic properties of Mott-insulating phases of ultracold Bose and Fermi spin or gases in optical lattices. We consider in particular the F = 2 Bose gas, and the F = 3/2 and 5/2 Fermi gases. We derive effective spin Hamiltonians for one and two atoms per site and discuss the possibilities of manipulating the magnetic properties of the system using optical Feshbach resonances. We discuss low temperature quantum phases of a 87Rb gas in the F = 2 hyperfine state, as well as possible realizations of high spin Fermi gases with either 6Li or 132Cs atoms in the F = 3/2 state, and with 173Yb atoms in the F = 5/2 state. © IOP Publishing Ltd and Deutsche Physikalische Gesellschaft.