This question is somewhat related to this question, with the main difference that you also have an translation.
Lets first make sure that the notation is clear:
A vector $\vec{v}$ can be represented in the initial Cartesian coordinate system as,
$$
\vec{v} =
\begin{bmatrix}
\vec{e}_x \\ \vec{e}_y \\ \vec{e}_z
\end{bmatrix} \cdot
\begin{bmatrix}
v_x \\ v_y \\ v_z
\end{bmatrix}
= v_x \vec{e}_x + v_y \vec{e}_y + v_z \vec{e}_z,
$$
where $\vec{e}_x$, $\vec{e}_y$ and $\vec{e}_z$ are the orthonormal basis vectors of the initial Cartesian coordinate system.
Similar, the vector $\vec{v}$ can also be represented in the new Cartesian coordinate system as,
$$
\vec{v} =
\begin{bmatrix}
\vec{e}_u \\ \vec{e}_v \\ \vec{e}_w
\end{bmatrix} \cdot
\begin{bmatrix}
v_u \\ v_v \\ v_w
\end{bmatrix} + \vec{o}
= (v_u + o_u) \vec{e}_u + (v_v + o_v) \vec{e}_v + (v_w + o_w) \vec{e}_w,
$$
where $\vec{o}$ is the vector connecting the initial and new origin and $\vec{e}_u$, $\vec{e}_v$ and $\vec{e}_w$ are the orthonormal basis vectors of the new Cartesian coordinate system, however these can be written as a linear combination of the basis vectors of the initial Cartesian coordinate system,
$$
\vec{e}_u = e_{ux} \vec{e}_x + e_{uy} \vec{e}_y + e_{uz} \vec{e}_z,
$$
$$
\vec{e}_v = e_{vx} \vec{e}_x + e_{vy} \vec{e}_y + e_{vz} \vec{e}_z,
$$
$$
\vec{e}_w = e_{wx} \vec{e}_x + e_{wy} \vec{e}_y + e_{wz} \vec{e}_z.
$$
If $e_{wx}$, $e_{wy}$ and $e_{wz}$ are unknown you can find it by taking the cross product. Assuming that the initial basis vectors are right-handed, then $\vec{e}_w$ can be found with,
$$
\vec{e}_w = \vec{e}_u \times \vec{e}_v = (e_{uy}e_{vz} - e_{uz}e_{vy}) \vec{e}_x + (e_{uz}e_{vx} - e_{ux}e_{vz}) \vec{e}_y + (e_{ux}e_{vy} - e_{uz}e_{vx}) \vec{e}_z,
$$
The rotation of the basis vectors can be calculated with the help of the rotation matrix and can be found with the help of dyadic products,
$$
R = \vec{e}_u\vec{e}_x + \vec{e}_v\vec{e}_y + \vec{e}_w\vec{e}_z,
$$
this yields a second order tensor. In order to calculate the rotation you would have to take the dot product, but if you instead of dyadic products use vector direct products you can use a normal matrix-vector multiplication. In MATLAB this would can be done with,
R = eu * ex' + ev * ey' + ew * ez';
such that,
$$
\begin{bmatrix}
v_u \\ v_v \\ v_w
\end{bmatrix}
= R
\begin{bmatrix}
v_x \\ v_y \\ v_z
\end{bmatrix} +
\begin{bmatrix}
o_u \\ o_v \\ o_w
\end{bmatrix}.
$$
Best Answer
Since this is a math site, I'll answer this in a mathematical format. It will probably translate relatively directly to whatever software library you are currently using.
The first step is to identify the 3D coordinates of the following points:
That is, the three points $\mathbf p_0,$ $\mathbf p_1,$ and $\mathbf p_2,$ which describe the origin of the 2D coordinates and points on the two axes of the 2D coordinates, have 3D coordinates that could be written as column vectors like this: $$ \mathbf p_0 = \begin{pmatrix} p_{01} \\ p_{02} \\ p_{03} \end{pmatrix},\quad \mathbf p_1 = \begin{pmatrix} p_{11} \\ p_{12} \\ p_{13} \end{pmatrix},\quad \mathbf p_2 = \begin{pmatrix} p_{21} \\ p_{22} \\ p_{23} \end{pmatrix}. $$ From these points we can derive two vectors: $\mathbf e_1 = \mathbf p_1 - \mathbf p_0$ and $\mathbf e_2 = \mathbf p_2 - \mathbf p_0,$ where the subtraction is a componentwise vector operation.
Now to translate any 2D coordinates $(x,y)$ into 3D coordinates, you perform scalar multiplication (scaling) and componentwise addition of these vectors to produce a 3D point $\mathbf p$: $$ \mathbf p = \mathbf p_0 + x \mathbf e_1 + y \mathbf e_2. $$ (That is, $x\mathbf e_1$ multiplies each coordinate of $\mathbf e_1$ by $x,$ and so forth.)
If your library supports matrices and matrix multiplication (which seems likely), you can put the coordinates of $\mathbf e_1$ and $\mathbf e_2$ side by side in two columns within a matrix, and then for any 2D coordinates $(x,y)$ peform the following matrix multiplication, which produces a $3$-element column vector: $$ \mathbf p = \mathbf p_0 + \begin{pmatrix} e_{11} & e_{21} \\ e_{12} & e_{22} \\ e_{13} & e_{23} \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix} $$
And that is how you convert any 2D coordinates to 3D.
To convert in the opposite direction, from 3D to 2D, I'll assume you want orthogonal projection, that is, you want to map each point in the 3D space to the closest point in the 2D plane. You do this with the same vectors $\mathbf e_1$ and $\mathbf e_2$ that you used for the 2D-to-3D transformation, as well as the 3D coordinates $\mathbf p_0$ of the origin of the 2D system.
Given a point in 3D coordinates, expressed as a column vector $\mathbf p,$ take the following dot products (aka inner products): \begin{align} x &= (\mathbf p - \mathbf p_0) \cdot \mathbf e_1, \\ y &= (\mathbf p - \mathbf p_0) \cdot \mathbf e_2. \end{align} Then $(x,y)$ are the desired 2D coordinates.
Depending on your library, it might not have an explicit dot product operation but might allow you to transpose a vector instead, in which case you can use matrix multiplication on the "vectors" in order to compute the dot products, for example, using the superscript $T$ to indicate a transpose, as in $\mathbf v^T,$ $$ x = (\mathbf p - \mathbf p_0)^T \mathbf e_1. $$