Quitting a postdoctoral fellowship
Obviously, you need to see the contract, and preferably go over it with an attorney.  There may be a repayment agreement.  You don't know until you look.

As to whether you can leave this postdoc early, I recommend thinking about how public the info would be, and how your colleagues in your field would look at it if they knew about it.

Personally, I could never hold it against a postdoc if they left to grab a dream faculty position.  I imagine this happens with some regularity.  That said, I would personally think less of a person that accepted a two-year position with the secret intent of leaving after a year. An institution is making an investment in you, and you would be letting them down.  I would think of it as you entering an agreement in poor faith.

Needing to relocate for personal reasons after a year is a decision that only you can make. If it's important to you, you might consider honestly discussing your situation with the manager of whatever program you're involved with before you sign on the bottom line.  It may be fine with them.  They might even be amenable to some form of telecommuting! If you choose to do this, you should do it knowing that a revocation of the offer is a real possibility.