As Francois Ziegler answered, the Bohr compactification is a compactification in the usual sense iff $G$ is compact. This is true with no restrictions (apart of local compactness).
By a "compactification in the usual sense" of a locally compact space $X$ I mean a continuous map $f:X\to Y$ where $f(X)$ is dense in $Y$ and $f:X\to f(X)$ is a homeomorphism. In that case $f(X)$ is necessarily open in $Y$ (this an easy exercise).
In case $X$ and $Y$ were groups and $f$ a group homomorphism, $f(X)$ was also closed, as any open subgroup is closed, thus $f(X)=Y$ by density. So $X$, being homeomorphic to $Y$, must have been compact to begin with.
More generally, let me note that any locally compact subgroup of any topological group is necessarily closed (and if the ambient group is locally compact, a subgroup is locally compact iff it is closed).
Remark: To cope with Ziegler's note, recall that the "Bohr compactification" is a the left adjoint functor to the forgetful functor from "compact groups" to "topological groups" and it always exists, though quite often the obvious (unit) map from a group to its Bohr compactification is not injective (and while the question still makes sense, its answer is clearly "no").