5-aminosalicylic acid (more commonly called mesalazine) is a salicylate (just like aspirin). Data in humans on its use during pregnancy and breast-feeding is not available. It is not permitted to be used during the last weeks of pregnancy.
There is a small theoretical risk that mesalazine may produce premature closure of a vital passage (called ductus arteriosus), may cause impairment of the renal (kidney) system in the foetus and may prolong labour and delay birth.
It is recommended that breast feeding be discontinued during use of mesalazine by the mother since the drug is excreted in mothers milk.
Generally the use of mesalazine for eight weeks results in remission of ulcerative colitis; hence I do not know why you are using it for 6 months or a year.
Good nutritious diet, adequate in vitamins, minerals is recommended so that baby is not deprived of the same. However this can be taken care of by taking supplements.