An old paper of R. Baer, *Groups with preassigned central and central quotient groups*, Trans. Amer. Math. Soc. **44** (1938), no. 3, 387-412, MR1501973, available on-line [here](http://www.ams.org/journals/tran/1938-044-03/S0002-9947-1938-1501973-3/S0002-9947-1938-1501973-3.pdf), can be used to determine which abelian $p$ groups can be embedded as the center of a group with index $p^n$ for any $n\gt 1$.  The paper considers the problem addressed in the title, and has both an existence and a uniqueness theorem. The existence theorem is restricted to the case in which the central quotient group is a direct sum of cyclic groups, and the uniqueness theorem is further restricted to the case in which the central quotient is finitely generated.

Some notation before stating the main existence result: given an abelian group $A$, $r(A)$ denotes minimum cardinality of a maximal linearly independent subset of $A$ (if $A$ is torsion free or of prime exponent, then any maximal linearly independent subset has $r(A)$ elements, but for more general abelian groups this need not be the case). $A_{t}$ denotes the torsion subgroup of $A$, $A[n]$ the subgroup of elements $x$ such that $nx=0$, and $A(p)$ the subgroup of elements such that $p^ix=0$ for some $i\geq 0$ ($p$ a prime, of course). 

Define $r(A,0)$ to be the rank of $A/A_{t}$, and $r(A,p^i)$ to be the rank of $(p^{i-1}A(p))/(p^iA(p))$

The main result of the paper is:

> **Existence Theorem.** If $A$ is an abelian group and $G$ is a direct sum of cyclic groups, then the following conditions are necessary and sufficient for the existence of a group whose center is $A$ and whose central quotient is isomorphic to $G$:
>
> 1. If $G$ contains elements of order $p^i$, then $A$ contains elements of order $p^i$.
> 2. If $G$ contains elements of infinite order, then $A$ contains elements of infinite order, or the orders of the elements in $G_t$ are not bounded.
> 3. If the orders of the elements in $G_t$ are bounded, and $r(G,0)$ is an finite positive integer, then $A$ contains elements of infinite order and $1\lt r(G,0)$. 
> 4. If the orders of the elements in $G_t$ are bounded, and $r(G,0)$ is an odd positive integer, then $A$ contains two independent elements of infinite order ($r(A,0)\gt 1$).
> 5. If $G=G_t$, $G(p)\neq 0$, and the orders of elements in $G(p)$ are bounded, then $G(p)$ contains at least two independent elements of maximum order.
> 6. If $G=G_t$, and the orders of elements in $G(p)$ are bounded, then if $r(G,p^{i+k})$ is finite with $k\geq 0$ and $r(G,p^i)$ is odd, then $A$ contains two independent elements of order $p^i$ ($r(p^{i-1}A[p])\gt 1$).


So fix $n\gt 1$; if $A$ is an arbitrary nontrivial abelian $p$-group, then let $G$ be the direct sum of $n$ copies of the cyclic group of order $p$. Then 1 is satisfied, 2, 3, and 4 are vacuously true, and $5$ is true. 

Now, since $G(p)=G$, and $pG=0$, for point 6, note that for any $i\gt 1$ we have $r(G,p^i)=0$; and $r(G,p)=n$; if $n$ is even, then 6 is satisfied vacuously, so you can always obtain a group. (You can realize it taking an element $x$ of order $p$ in $A$, letting $G$ be the extraspecial $p$-group of order $p^{2n+1}$ with center generated by $c$, and taking the group $A\times G/\langle (x,z^{-1})\rangle$, an amalgamated direct product; same idea as the construction given by [Konstantin Ardakov](http://mathoverflow.net/users/6827/konstantin-ardakov) in the comments.

If $n$ is odd, however, then condition $6$ requires that $A$ contain at least two independent elements of order $p$.

Since a finite abelian group is capable if and only if it is not cyclic and the two largest invariants are equal, if we realize $A$ as the center of a group $B$ with $[B:A]=p^{2k+1}$, then $B$ must be a direct sum of the form $C_{p^{a_1}}\oplus\cdots\oplus C_{p^{a_r}}$ with $r\gt 1$ and $a_{r-1}=a_r$, any $G$ we try to use must have at least three cyclic summands, and so picking a different group $G$ to be a central quotient would only put stronger conditions on $A$ (e.g., requiring $A$ to contain at least two independent elements of order $p^i$ for several different $i$).

In summary:

Let $A$ be an abelian $p$-group, not necessarily finite, and let $n\gt 0$. Then $A$ can be realized as the center of a $p$-group $H$ with $[H:A]=p^n$ if and only if: (i) $A$ is trivial and $n=0$; (ii) $A$ is nontrivial and $n$ is even; or (iii) $A$ is nontrivial, $n\gt 1$ is odd, and $A$ has at least two independent elements of order $p$.