Yes. Under Title IX your institution must excuse any absences related to these conditions, so long as your doctor says the absence is medically necessary.
Further, your school’s disability leave policy and/or maternity leave policy may provide leave for time periods even longer than what is medically necessary.
When you return from your absence, you must be reinstated to the same status you held before you left—there can be no penalty for your leave.