Dear Anna
I think the problem is that udunits thinks g is a unit of acceleration!
However, it will accept gram and milligram, so you could try that instead.
$ udunits
You have: g
You want: m s-2
<m s-2> = <g>*9.80665
<m s-2> = <g>/0.101972
You have: milligram
You want: kg
<kg> = <milligram>*1e-06
<kg> = <milligram>/1e+06
Cheers
Jonathan