Drs orders

Why do doctors tell women who have just given birth to not have sex for a certain amount of time? (I have never had a baby and want to know lol)