HR is threatened same way as other departments. With improvements in technology, creation of shared services, outsourcing, integration of processes etc, headcount will mostly be affected.
As individuals, whether in HR or other departments, we need to always prepare for tomorrow. Learn new things, manage our resources well, be open to new challenges,etc