We combine computable structure theory and algorithmic learning theory to study learning of families of algebraic structures. Our main result is a model-theoretic characterization of the class $mathbf{InfEx}_{cong}$, consisting of the structures whose isomorphism types can be learned in the limit. We show that a family of structures $mathfrak{K}$ is $mathbf{InfEx}_{cong}$-learnable if and only if the structures from $mathfrak{K}$ can be distinguished in terms of their $Sigma^{mathrm{inf}}_2$-theories. We apply this characterization to familiar cases and we show the following: there is an infinite learnable family of distributive lattices; no pair of Boolean algebras is learnable; no infinite family of linear orders is learnable.