Primary radars (PSR) used by military can detect civilian aircraft exactly the same way, and with the same limits, than they detect military aircraft.
The SSR transponder of civilian aircraft plays no role in this type of detection. Note military aircraft also use transponders.
For a primary radar an aircraft is a reflective target, the larger the better. So it's actually easier to detect large civilian aircraft than small military aircraft. One important criterion is the radar cross section (RCS) of the target, this is the target area required to produce the echo the radar senses. Depending on the geometry, the material, the wavelength used, etc, this area may be smaller than the actual target cross section area.
For reference an octahedral corner reflector 45x45 cm used on boats has a mean RCS of 3.5 m².

RCS for a S band monostatic antenna:
$$
\begin{array}{|r|l|}
\hline
RCS & Object \\
\hline
\text {100 m²} & \text {Ship} \\
\text {50-100 m²} & \text {Large body a/c} \\
\text {10-50 m²} & \text {Medium range a/c} \\
\text {2 - 10 m²} & \text {Large military a/c} \\
\text {1 - 2 m²} & \text {Small military a/c} \\
\text {1 m²} & \text {Human body} \\
\text {0.1 m²} & \text {Missile, stealth bomber} \\
\text {0.01 m²} & \text {Drone, stealth fighter} \\
\text {0.001 m²} & \text {Shell} \\
\hline
\end{array}
$$
Source for values
The table says a medium-sized commercial aircraft is more easily detected, by 10 times, than a small military aircraft.
Some countries share the radar antennas between civilian and military, for example, Switzerland, a small and mountainous country, just uses all radars for all purposes, in a whole system named Florako (also on Wikipedia).
The major advantage of using a primary radar is its ability to detect targets without their cooperation (transponder answering the interrogator). The cons are its cost, the power required and:
A limit in distinguishing aircraft in crowded airspace. A secondary radar using individual airborne transponders is more powerful.
A potentially lower azimuth accuracy than SSR (secondary radar).
The inability to determine a precise altitude, though some short range PSR are specially made for this.
The difficulty to detect very close targets. It uses a single frequency for transmission and reception, therefore a close target echo may reach the antenna while the radar is still transmitting, and be ignored. This problem doesn't occur with SSR where the ground station and the airborne transponder transmit on two separate frequencies.
The difficulty to detect very remote targets, due to field intensity attenuation with the square of the distance. A SSR transponder generates a separate stronger signal for the return trip. However some primary radars offset this attenuation using huge transmission powers. After solving the problems created by the larger power they have a larger range than SSR, which don't need extreme ranges and use smaller power levels.
Both PSR and SSR are limited by the radio horizon, e.g. for a station at a height of 100 m, the radio horizon is about 47 km. This distance can be reduced by natural obstacles, like hills, and built obstacles like wind turbines. Aircraft can use this protection to fly "below the radar". To prevent this radar stations must be sited at the top of hills and peaks and secondary (mobile) stations sweep valley areas. A station at a heigh of 2,000 m has its radio horizon at about 210 km (calculator, add 1/3 for wave refraction in troposphere).
Some military primary radars use the lowest frequency bands for trans-horizon detection of missiles. They are de facto able to detect larger RCS targets, including any aircraft, but with a low azimuth precision.
New radar types, said multi-static (MSPSR) are able to detect echo from targets illuminated by sources other than their own antennas. This increases the detection ability, including for stealth aircraft. Other sources include cellular phone stations and TV broadcast towers, but also distant radars. MSPSR can be passive, not emitting any signal, but still be more effective than monostatic active stations.