A total of £25m is to be invested in maternity services in Glangwili hospital in Carmarthenshire three years after report criticised facilities.
A further £3.1m has been earmarked for cancer services at Withybush hospital in Haverfordwest, Pembrokeshire.
The funding announcement by the Welsh Government comes a week before Hywel Dda health board is due to reveal its preferred proposals for reorganising NHS services in west Wales.
Options include shutting hospitals.
Health Secretary Vaughan Gething said the cash for obstetric and neonatal facilities at Glangwili addressed “urgent areas of concern” raised in a report that said labour ward services there were not fit for purpose.
Seven out of the nine options being considered by Hywel Dda involve closing or downgrading hospitals, according to documents leaked earlier this year.
In 2015, the Royal College of Paediatrics and Child Health said that the Glangwili labour ward was “too small, with insufficient facilities and provides a poor environment for women and staff”.
The money for Glangwili will be spent on more high dependence cots, special care cots and parent overnight stay rooms, as well as increasing the number of birthing rooms, operating theatres and resuscitation bays.
Mr Gething said: “This funding will improve the clinical quality, safety and innovation at the site.
“It will mean better access to services for patients and their parents, as well as improving the well-being of staff.”
Work is expected to start before the autumn, with the scheme complete by 2020.
Meanwhile, £3m is to be spent on modernising haematology, oncology and palliative care services at Withybush Hospital, Haverfordwest.
A total of £450,000 had already been raised to improve facilities by Hywel Dda’s Pembrokeshire Cancer Services Fund and Elly’s Ward 10 Flag Appeal.
But Plaid Cymru’s health spokesman Rhun ap Iorwerth said: “Neonatal services at Withybush Hospital have already been lost.
“While this £25m investment at Glangwili is, of course, welcome news, it should be additional funding rather than merely a case of making up for closures elsewhere.
“It is also worrying to see a lack of proper long-term planning for health care provisions in the area given the uncertainty over the future of local hospitals.”