Section 23A. Any child born to an inmate of the Massachusetts Correctional Institution, Framingham, or of the Industrial School for Girls at Lancaster, or of a jail or a house of correction, shall be accepted by the department, and any child whose mother is committed to the Massachusetts Correctional Institution, Framingham, to a jail or a house of correction, or to the custody of the youth service board, may be accepted by the department. Thereupon the department in consultation with the commissioner of correction or the chairman of the youth service board shall make such provision at said place of commitment or elsewhere for the care of said child as may seem to be for the best interests of said child.