The Definition of Ordinals and the Axiom of Regularity
Eric Wofsey's answer shows that regularity for sets implies regularity for classes, provided you have enough other axioms (like replacement) available. In the particular case you asked about, where the class $A$ consists of transitive sets, you can avoid part of Eric's argument, namely the part where he produces a transitive set $T$.
In detail: Given a nonempty class $A$ of transitive sets, begin by considering some $y\in A$. If you're very lucky, $y\cap A=\varnothing$ and you're done. So suppose from now on that $y\cap A$ is a nonempty set. (It's a set, not a proper class, because $y$ is a set.) By regularity for sets, $y\cap A$ has an element $z$ with $z\cap y\cap A=\varnothing$. So we have $z\in A$, and if we can show $z\cap A=\varnothing$ then we'll be done.
Now we use that all elements of $A$ are transitive. In particular $y$ is transitive, so, from $z\in y$, we get $z\subseteq y$ and thus $z\cap y=z$. But then what we already knew, that $z\cap y\cap A=\varnothing$, simplifies to $z\cap A=\varnothing$, and the proof is complete.