I first point that you should always assume that $f(1) = 1$, that is part of the definition of a ring morphism. I will also assume that $A$ and $B$ are commutative (otherwise it gets a little trickier).
Then an obvious necessary condition for $f$ to preserve degree is that $f$ sends constants to constants, meaning that the restriction of $f$ to $A$ is a ring homomorphism from $A$ to $B$ (it is not automatic !). It should also be injective since otherwise you have $a\in A$ such that $f(a)=0$, hence $f(aX)=0$ so degree is not preserved.
Then the second condition is that $f(X)$ has degree $1$, hence $f(X)=aX + b$, with $a,b\in B$ and $a\neq 0$. Then if $P\in A[X]$ has highest-degree term $a_nX^n$, the highest-degree term of $f(P)$ is $f(a_n)a^nX^n$. Since you want this term to be non-zero, it follows that $a$ should not satisfy $xa^n=0$ for any non-zero $x\in A$ and $n\in \mathbb{N}$ (this is clearly satisfied if $a$ is not a zero divisor, and in particular when $B$ is a domain, but this needs not be the case).
On the other hand, if you want $f$ to be invertible, then first obviously you need its restriction to $A$ to be invertible, so $f$ is an isomorphism between $A$ and $B$. You also need $a$ to be invertible, and this is enough, since then you can define its inverse by the inverse of $f_{|A}$ on the elements of $B$, and $f^{-1}(X) = a^{-1}(X-b)$.
In conclusion : for $f$ to preserve degree is equivalent to $f_{ |A}$ being an injective homomorphism from $A$ to $B$, and $f(X) = aX+b$ with $a,b\in B$ and no power of $a$ being annihilated by an element of $f(A)\setminus \{0\}$ ; on the other hand, for $f$ to be bijective is equivalent to $f_{|A}$ being an isomorphism from $A$ to $B$ and $f(X) = aX + b$ with $a,b\in B$ and $a$ invertible. So clearly the second condition is stronger, and they are almost never equivalent (you would need huge restrictions on $A$ and $B$, though it does work for $A=B=\mathbb{Q}$).