This is a very common question asked daily so I recommend you browse the forum or visit the FAQ section for some more detailed information.
The short answer is yes, but it will require some sacrifice. Pilots travel away from home, that’s what we do. As you gain seniority you’ll have more control over your schedule. In the beginning it’ll be tough but yes most pilots have families and make it work just fine.
In some ways I feel that I am actually available more to my family because of the job. When I am home, I am truly home. No phone calls, emails, projects to work on, etc. Take a look at our schedules section, but I would say that I typically have anywhere from 12-16 days off per month. Yes, you will miss some things, that is just the way it goes, but in time you will have better control of your schedule. I would point out that the best thing you could do for time at home is to move to wherever you are based and not be a commuter.
Of course you can. Your spouse will need to be accepting and supportive of your career choice, of course. They are essentially a single parent when you are gone. You’ll know once you find the right person that accepts you and your lifestyle.