$Assumptions={-1+g h>0};

Sol = DSolve[{p''[t] + g*q''[t] + (m^2)*p[t]==0, q''[t] + h*p''[t] +(n^2)*q[t]==0, p[0]==Q, p'[0]==0, q[0]==0, q'[0]==0},{p[t],q[t]},t]//Simplify;

Sol//.((((m^4)+2 (-1+2 g h) (m^2) (n^2)+(n^4)))^(k_)):> (ω^(4k))//Simplify  (* Full solutions *)

SolRes = Sol//.{m->n}//Simplify (* Resonant solutions *)

SolpNum =ExpToTrig[(SolRes[[1,1,2]])/.{Q->1, n->(Sqrt[0.5]), g->0.05, h->0.025}]//Chop
SolqNum= ExpToTrig[(SolRes[[1,2,2]])/.{Q->1, n->(Sqrt[0.5]), g->0.05, h->0.025}]//Chop

Plot[{SolpNum, SolqNum}, {t,0,500}, PlotStyle->Automatic,PlotPoints->10, MaxRecursion->15] (* I removed plot to save bandwidth ; re-run the programme to display it. *)