It is a women's body and a women's right to choose. She should have told her husband, but it was clear this was not something he would have approved of. The real question is did she make the right choice by deciding to marry someone that she had to keep secrets from.
Trust is certainly key in a marriage, and there is no doubt that Naya Rivera did something to betray Ryan Dorsey's trust. However there is one other facet that is at least as important, and this is forgiveness. Human beings make mistakes, and as painful as they can be, most issues (not involving cheating, of course) should be reconciled with time.
Although I don't know if I would have made the same decision as Ryan, I'm glad that he was able to overlook her lie of omission and still want to marry her. Personally, I don't think that I would be able to trust her again after that, but if Ryan is happy, that's all that matters.
When going into a marriage the two parties have more than there share of difficulties without having to deal with a hidden action that could and will cause problems. If the two of them talked about it and decided to never hide such an important detail from their partner in the future than it could weigh on the chance that it would be all right with a marriage.