Lets assume that your system is of the form
$$ M(q)\ddot{q} + C(q, \dot{q})\cdot \dot{q} + G(q) = J(q)\tau$$
where \$q\$ is the vector of generalized coordinates and \$\tau\$ the vector of forces and torques acting on the system. We start the transformation into a 1rst order system by defining the state vector \$x\$ to be
$$ x^T = \begin{bmatrix}{q^T \ \dot{q}^T} \end{bmatrix}.$$
The first order system is then given by
$$\dot{x} = \begin{bmatrix}{\dot{q} \\ \ddot{q}} \end{bmatrix} =
\begin{bmatrix} 0_{n\times n} & I_{n\times n} \\ 0_{n\times n} & -M^{-1}(q)C(q, \dot{q})\end{bmatrix} \cdot \begin{bmatrix} q \\ \dot{q} \end{bmatrix} +
\begin{bmatrix} 0_{n\times n} \\ M^{-1}(q)\cdot J(q)\end{bmatrix} \cdot \tau+
\begin{bmatrix} 0_{n\times n} \\ -M^{-1}(q)\cdot G(q)\end{bmatrix}$$
by using the rearranged initial equation system
$$ \ddot{q} = M^{-1}(q)\cdot(J(q)\tau - C(q, \dot{q})\cdot \dot{q} - G(q))$$
for expressing the second derivative of the generalized coordinates by the state components and the control inputs. Therefore the system takes the desired form of
$$\dot{x} = A(x)\cdot x + B(x)\cdot \tau + D(x).$$
The approach to finding a 1rst order state space representation of given set of differential equations is always the same. First, define your vector of states. In a second step, express the derivative of the state vector in terms of the states and control inputs by also making use of the original (rearranged) differential equation system.