The maximum period of nifas (postpartum period) which comes after child birth is forty days. It is fardh to make ghusl and start offering salah if the blood stops before forty days. So in the question mentioned above you should not wait till forty days rather you should start offering salah after the blood stops and start keep fast of Ramadan.
Allah knows Best!
Darul Uloom Deoband