Sex after a csection

I was wondering when is it considered safe to have sex after a csection. I know doctors say wait 6 weeks but does it have to be that long?? If so why.