Let $S$ be a finite semigroupoid and let $a\in S$. The minimum of $$\{n\in \Bbb N \mid a^{n+1}=a \}$$ , if it exists, is called the order of $a$ and is denoted by $o(a)$.
Which conditions on $S$, guarantee
$$o(a)\mid |S|$$
To be more specific, is it true if $S$ is a
Lagrange's theorem is very much specific to groups. Here are some counterexamples.
In the comments you ask about the case that $S$ is a cancellative semigroup. Since you ask whether a number can divide $|S|$, implicit here is the assumption that $S$ is finite.
Proposition: A finite cancellative semigroup is a group.
Proof. Let $S$ be such a semigroup. Then for every $s \in S$, the function
$$x \ni S \mapsto sx \in S$$
is injective by assumption. Since $S$ is finite, it must also be bijective and have order dividing $|S|!$. It follows that some power of $s$ acts as a left identity. Similarly, some power of $s$ acts as a right identity. It follows that some power of $s$ acts as an identity, call it $e$. Then for every $s$ there exists $s^{-1}$ such that $s s^{-1} = e$, so every element has a right inverse, and similarly every element has a left inverse, and these must agree. $\Box$