Relationship $q(TX,TY)=q(X,Y)$ can be written under a matricial form
$$\forall X,Y \ \ (TX)^tQ(TY)=X^tY \ \iff \ X^t(T^tQT)Y=X^tQY$$
which means that $T^tQT=Q.$
Written in terms of block matrices, it means that:
$$\underbrace{\begin{pmatrix} X^t & \gamma \\ \beta^t & d \end{pmatrix}\begin{pmatrix} I_{n} & 0 \\ 0 & -1 \end{pmatrix}}_{}\begin{pmatrix} X & \beta \\ \gamma^t & d \end{pmatrix}=\begin{pmatrix} I_{n} & 0 \\ 0 & -1 \end{pmatrix} \ \ \iff$$
$$\begin{pmatrix} X^t & -\gamma \\ \beta^t & -d \end{pmatrix}\begin{pmatrix} X & \beta \\ \gamma^t & d \end{pmatrix}=\begin{pmatrix} I_{n} & 0 \\ 0 & -1 \end{pmatrix} \ \ \ \iff$$
$$\tag{1}\iff \ \ \ \begin{cases}X^tX -\gamma \gamma^t &=& I_{n}& \ \ \ \text{matrices}\\ X^t\beta - d \gamma &=&0 & \ \ \ \text{vectors}\\ \beta^t\beta-d^2&=&-1& \ \ \ \text{scalars}\end{cases}$$
We will only consider the first of these equations, under the form:
$$X^tX = I_{n}+\gamma \gamma^t$$
and take the determinants on both sides.
On the LHS, we get
$$\tag{2}det(X^tX)=det(X^t)det(X)=det(X)^2.$$
For the RHS, we are going to use a (rather classical) formula for the determinant of such a matrix ("identity matrix perturbated by a rank-one matrix") (https://en.wikipedia.org/wiki/Matrix_determinant_lemma) or (Determinant of rank-one perturbations of (invertible) matrices)
which gives (see the order of multiplication of the matrices)
$$\tag{3}det(I_{n}+\gamma \gamma^t)=1+\gamma^t\gamma=1+\|\gamma\|^2>0.$$
Comparing (2) and (3), we have necessarily:
$$det(X)\neq0.$$
Remark: The structure of "isometries" preserving the quadratic form is encapsulated into formulas (1). The case $n=1$ is especially simple. In this case, all of $X,\beta,\gamma$ and of course $d$ are reals; thus, we can write:
$$\begin{cases}X^2 &=&\gamma^2+1\\ X\beta &=& d\gamma\\ d^2&=&\beta^2+1\end{cases}$$
which is equivalent to $X=\pm d = \cosh(u)$ and $\gamma = \pm \beta = \sinh(u)$ for a certain $u$. Thus, we have two types of "hyperbolic isometries":
$$\begin{pmatrix}\cosh(u) & \sinh(u) \\ \sinh(u) & \cosh(u) \end{pmatrix} \ \ \ \text{and} \ \ \ \begin{pmatrix}\cosh(u) & -\sinh(u) \\ -\sinh(u) & \cosh(u) \end{pmatrix}.$$