How young and how old? That would be my first worry. For instance, someone in their early 20s or younger, with someone in their 40s or older would have the odds stacked against them in a relationship. I'm not saying that you wouldn't be the exception if you are in those ages, but I'd be surprised. (It's easier to have that type of age spread if you both have some life experience - a 40 year old with a 60 year old, for instance, doesn't have nearly the gap in life experience even if the age difference is the same; You change a ton in your first 10 years of life, quite a bit in your next 10, still quite a bit in the next 10, but then a bit less in the next 10, and even less in the next 10...)
I'd say a serious relationship is going to need in-real-life contact. It's easier to hide our annoying habits online - but those habits may turn into the things that a potential spouse can't stand! I know lots of people who met online, so it can work fine. Just knowing someone online and knowing them 24/7 in real life is a different thing entirely.
As for legal issues, it may or may not be possible, depending on jurisdiction that you live in. In the US, no marriage where a person is post-op trans and the other is not is safe in all 50 states (regardless of whether or not the marriage is same sex or opposite sex). However, it may be safe in some states. Marriage pre-op is generally seen as same sex marriage, regardless of what identification lists for gender (the identification is not the primary evidence of your sex, your actual sex is, and if the two conflict, legally the person's actual sex, not the paper document, is what makes the determination). Different states have different standards for determining sex (none use paper documents as their determination, although paper documents sometimes are acceptable for a given agency's rules), but no state that I know of (nor the feds) have actual statutes that define "man" and "woman". So it's basically up to what judges in that jurisdiction have decided in the past (in a handful of jurisdictions) or what judges *might* decide in the future (in the rest of the jurisdictions). I'm in a heterosexual relationship - but because one of us wasn't always seen as who we are, our relationship's status changes as we drive across the country. We go from married to not-married to married as we cross state or district lines.
Transition is very stressful. I'll also say that surgery is a big deal and there are risks of any surgery (such as the possibility of sexual difficulties and the risk of infection in the case of SRS). There's a lot of important post-op care that's needed too. So the stress doesn't necessarily end at the time of surgery. Even putting surgical concerns aside, she might (or might not) have body image concerns, be sensitive about being outed, might not pass 100% of the time (are you able to be comfortable with reacting if someone thinks she is male? can you accept your family and friends finding out about her past, if that happens?), etc. Of course the surgery could easily go very well, she might not ever get outed, and she might pass well enough that your friends and family will never know. But she might not too. Are you prepared for that? If not, it's something you need to talk about with her. Personally, I don't find these types of things that much different from the things we all carry around with us anyhow - everyone has areas where they need more support than someone else might need.
All this doom and gloom said, it's definitely possible that this will work out fine and you will have a wonderful long-term relationship. If you love her, and she loves you, I think you can find ways to make any relationship work. It's cliche, but it's also true.