In the case, bitcoin transactions are becoming less frequent, will the blockchain become unsafe?
It's not the number of transactions that determines the security level, it's the amount of work done to partially invert the hash function. For the same difficulty level, this is proportional to the number of blocks mined (though Bitcoin scales the difficulty to even out the time between blocks). In the short run, the miners do not really care if there are many transactions or few transactions available to include in the block -- they've already invested in the high fixed cost of ASIC mining hardware.

To pull off a 51% attack, the attacker would have to provide as much computing power as all legitimate miners do. A slight drop in the popularity of Bitcoin isn't going to cut it.