The hair grafts are very fragile and sensitive so should be avoided any kind of hats and helmets on the scalp. Sudden pressure will harm the roots and due to which the roots can fall out.
After hair transplant your scalp tends to be more sensitive, so anything hard can possible to damage the hair roots. Wearing hats or helmet will make your scalp to sweat which is harmful to your scalp. However, after a period of 1 month, it is generally considered safe to start wearing helmets or any other headgear.