TITLE: Everywhere locally isomorphic abelian varieties
QUESTION [19 upvotes]: Is there a standard example of two abelian varieties $A$, $B$ over some number field $k$ which are $k_v$-isomorphic for every place $v$ of $k$ but not $k$-isomorphic ?

REPLY [26 votes]: (If you upvote this answer, please consider upvoting the answers by Felipe Voloch and David Speyer too, since this answer builds on their ideas.)
The smallest examples are in dimension $2$.  Let $E$ be any elliptic curve over $\mathbf{Q}$ without complex multiplication, e.g., $X_0(11)$.  We will construct two twists of $E^2$ that are isomorphic over $\mathbf{Q}_p$ for all $p \le \infty$ but not isomorphic over $\mathbf{Q}$.
Let $K:=\mathbf{Q}(\sqrt{-1},\sqrt{17})$.  Let $G:=\operatorname{Gal}(K/\mathbf{Q}) = (\mathbf{Z}/2\mathbf{Z})^2$.  Let $\alpha \colon G \to \operatorname{GL}_2(\mathbf{Z}) = \operatorname{Aut}(E^2)$ be a homomorphism sending the two generators to the reflections in the coordinate axes of $\mathbf{Z}^2$, and let $A$ be the $K/\mathbf{Q}$-twist of $E^2$ given by $\alpha$.  Define $\beta$ and $B$ similarly, but with the lines $y=x$ and $y=-x$ in place of the coordinate axes.  The representations $\alpha$ and $\beta$ of $G$ on $\mathbf{Z}^2$ are not conjugate: only the former is such that the lattice vectors fixed by nontrivial elements of $G$ generate all of $\mathbf{Z}^2$.  Thus $A$ and $B$ are not isomorphic over $\mathbf{Q}$.
On the other hand, every decomposition group $D_p$ in $G$ is smaller than $G$ since $-1$ is a square in $\mathbf{Q}_{17}$ and $17$ is a square in $\mathbf{Q}_2$.  Also, the restrictions of $\alpha$ and $\beta$ to any proper subgroup of $G$ are conjugate: any single line spanned by a primitive vector in $\mathbf{Z}^2$ can be mapped to any other by an element of $\operatorname{GL}_2(\mathbf{Z})$.  Thus $A$ and $B$ become isomorphic after base extension to $\mathbf{Q}_p$ for any $p \le \infty$. $\square$
Remark: The abelian surfaces $A$ and $B$ constructed above are isogenous even over $\mathbf{Q}$, because the $\mathbf{Z}^2$ with one Galois action can be embedded into the $\mathbf{Z}^2$ with the other Galois action: rotate $45^\circ$ and dilate.
Remark: The nonexistence of examples in dimension $1$ follows from these two well-known facts:
1) Twists of an elliptic curve over a field $k$ of characteristic $0$ 
are classified by
$H^1(k,\mu_n)=k^\times/k^{\times n}$ where $n$ is 2, 4, or 6.  
2) If $n<8$, the map $k^\times/k^{\times n} \to \prod_v k_v^\times/k_v^{\times n}$ is injective.  
[Edit: This answer was edited to simplify the construction and to add those remarks at the end.]