A statement of the form
For all $x \in A$, it holds that $P(x)$
$\forall x \in A : P(x)$
can be re-formulated to the logically equivalent statement
There is no $x \in A$ such that $P(x)$ does not hold
$\neg \exists x \in A : \neg P(x)$
In order to show that a claim is true for all elements of a set, it is equally legitimate to show that there is no element for which it does not hold.
When applying this reasoning to, e.g., the formula
All green elephants talk
$\forall x \in E: Talk(x)$
where $E$ is the set of green elephants,
we can as equivalently word it as
There is no green elephant who does not talk
$\neg \exists x \in E: \neg Talk(x)$
Obviously, if there are no green elephants at all, there will be no elephant who does not talk. Therefore, since we found no counterexample to the claim, we can - a bit unintuitively, but logically correct in classical logic - draw the conclusion that all elephants do talk.
The pattern becomes a bit more obvious when formulating the sentence with material implication:
For all $x$ it holds that if it is a green elehant, it talks
$\forall x (GreenElph(x) \to Talk(x))$
This formula becomes true if and only if all entities in the model's domain that we map the variable $x$ to make the inner statement true, or conversely, that there is no entity for which the statement is false.
When recalling the truth table of material implication, we know that the only way for a formula of the form $\phi \to \psi$ become false is when $\phi$ is true and $\psi$ is false, or conversely, if $\phi$ is fase, the formula will become true no matter whether $\psi$ is true or false.
Now if there are no entities which are green elephants, there is no instance which makes the left side of the implication ($GreenElph(x)$) true. Thus, regardless of whether this thing talks or not, the implication becomes true. So there is no $x$ such that $GreenElph(x)$ is true and $Talk(x)$ is false, so the implication becomes true for all entities in the domain, and in consequence, the universally quantified formula is true.
This phenomena of a universally quantified formula being satisfied due to the antecedent being false for any entity (i.e. the set that satisfies the restriction is the empty set) is also called vacuous truth.