Motivated by recent experimental advances in ultracold atomic gases placed in cavities, we study the influence of the atom-cavity coupling on the Fermi gases trapped in optical lattices. By adiabatic elimination of the cavity photon field, the atom-cavity coupling gives rise to effective long-range interactions. It results in a variety of two-body scattering processes, during which the atomic pairs can acquire an additional center-of-mass momentum. This reveals the possibility of Fulde-Ferrell-Larkin-Ovchinnikov (FFLO) superfluids in which the atomic pairing momentum is nonzero. By inspecting the phase diagram at the mean-field level, we confirm that the FFLO superfluid phase coexists with the zero-momentum pairing, and is the ground state that hosts the lowest energy. Furthermore, the order parameter characterizing the nonzero-momentum pairing does not vanish as long as the cavity-induced interaction is present.