What function does the yolk sac have in pregnancy and does it remain for the 9 months?

Yes it remains. The innitial funtion of the yolk sac is to produce first blood cells of the little baby. Later on remains in pregnancy as a tiny white bubble. It can be seen after the placenta is delivered if you look carefully for it.