No, hats cannot be transferred directly between accounts. Roblox does not support gifting items from your own inventory.
The workaround is to donate Robux. Send the other player funds and they can buy the hat themselves from the catalogue. Groups with a payout system are the usual way people arrange this.
Be careful who you trade with, though. Scammers frequently pose as generous gifters, so never hand over account details in exchange for a promised item.