A technical recession occurs when a country's GDP contracts for two consecutive quarters, indicating a decline in economic output.