Wearing a cap right after a hair transplant is not advisable as it can damage the implanted hair follicles.
Video: Can I wear a cap after a hair transplant?
Wearing a cap straight after going through a hair transplant can impair the surgery results. Hence, wearing even a loose cap is advised only after a couple of weeks.