Because we are working over a PID, all matrices have a Smith normal form. Let's apply that to the $1\times n$ matrix $R=(a_{11},\ldots,a_{1n})$.
The existence of a Smith normal form implies that there exists a $1\times 1$ matrix $P$ and and an $n\times n$ $Q$, both with determinant $1$, such that
$$
PRQ=\left(d_1,0,0,\ldots,0\right),\tag{1}
$$
where $d_1$ is the first invariant factor of $R$ (and this the only invariant factor given that $R$ has a single row only). Furthermore, $d_1$ is the gcd of the $1\times1$-minors of $R$.
In our special case we can immediately deduce that $d_1=1$ and that the factor $P$ really isn't there. Recalling that $\det Q=1$ we know that $Q^{-1}$ exists and has entries in our PID $A$. Therefore we can rewrite $(1)$ in the form
$$
R=\left(\begin{array}{cccc}1&0&\cdots&0\end{array}\right)Q^{-1}.\tag{2}
$$
But, expanding the right hand side of $(2)$, we see immediately that the first row $Q^{-1}$ is equal to $R$.
Therefore $Q^{-1}$ is the sought after matrix and we are done.
The argument generalizes to the following:
A $k\times n$ matrix $R$ with entries in a PID $A$ and all its invariant factors $d_1=d_2=\cdots=d_k=1$ can be completed to an $n\times n$ matrix $B$ with entries from $A$ and $\det B=1$
For the purpose of the task at hand invoking the full power of Smith normal forms is a bit overkill. We can build the required matrix $Q$ in stages using the following observation as an inductive step.
Assume that at least one of $a,b\in A$ is non-zero. Because $A$ is a PID, $d=\gcd(a,b)$ exists. Furthermore, by Bezout's identity we can find elements $u,v\in A$ such that $d=ua+vb$. As $d$ is a factor of both $a$ and $b$, we can find $x,y\in A$ such that $a=dx$, $b=dy$. To this data we associate the $2\times2$ matrix
$$
Q(a,b)=\left(\begin{array}{rr}u&-y\\ v&x\end{array}\right).
$$
This matrix has the following key properties:
- As $d\cdot\det Q(a,b)=d(ux+vy)=ua+vb=d$ and the cancellation law holds in $A$, we see that $\det Q(a,b)=1$.
- We have the matrix product identity
$$
(a\quad b) Q(a,b)=(d\quad 0).\tag{3}
$$
We then prove by the following
Claim. For any natural number $n$ and any vector $(a_1,a_2,\ldots,a_n)\in A^n$ there exists an $n\times n$ matrix $Q\in M_n(A)$ such that $\det Q=1$ and
$$
(a_1\quad a_2\quad\cdots\quad a_n)Q=(d\quad 0\quad\cdots\quad0),
$$
where $d=\gcd(a_1,a_2,\ldots,a_n)$.
Proof. An induction on $n$. The base case $n=1$ is trivial as we can use $Q=I_1$. Assume then that $n\ge2$. Let's write $d_2=\gcd(a_2,a_3,\ldots,a_n)$.
The induction hypothesis implies that we can find a matrix $Q_2\in M_{n-1}(A)$ with determinant $1$ such that
$$
(a_2\quad a_3\quad\cdots\quad a_n)Q_2=(d_2\quad 0\quad\cdots\quad0).\tag{4}
$$
Let
$$
\tilde{Q}_2=\left(\begin{array}{c|c}
1&\mathbf{0}\\
\hline
\mathbf{0}&Q_2\end{array}\right)
$$
be the $n\times n$ matrix gotten by adding an extra row and a column to $Q_2$ with all the other new entries equal to zero save for a single $1$ at position $(1,1)$. Obviously $\det\tilde{Q}_2=1$ also. In view of identity $(4)$ we have
$$
(a_1\quad a_2\quad\cdots\quad a_n)\tilde{Q}_2=(a_1\quad d_2\quad 0\quad\cdots\quad0).\tag{5}
$$
By basic properties of gcds we have $d=\gcd(a_1,d_2)$. The claim thus follows by multiplying $(5)$ from the right with the matrix
$$
Q_1=\left(\begin{array}{c|c}
Q(a_1,d_2)&\mathbf{0}\\
\hline
\mathbf{0}&I_{n-2}\end{array}\right),
$$
where $Q(a_1,d_2)$ is the $2\times2$ matrix from our earlier considerations, and the zero blocks have sizes $2\times (n-2)$ and $(n-2)\times 2$ respectively. Clearly $\det Q_1=1$, so $\det Q=1$ also. QED.