Unfortunately yes medical bills in collections can affect your credit score lowering it which in turn could affect the banks decision in whether to approve the mortgage or not.
If your credit score is lower than 700 then you'll have a hard time getting approved for a home mortgage without a cosigner on the mortgage.
If your credit score is low you'll need to try your best at paying off those medical bills and improving your credit score before getting a home mortgage.
If you're unable to get a traditional home mortgage you might also look into rent to own homes where you put some money down and then pay rent each month and then a portion of that rent goes towards the balance owed on the house.
Then after the lease is up you get a home mortgage or other loan to buy the property from the owner.
Doing the rent to own option will allow you to get into a home you might eventually own and build your credit during that time where you can hopefully get a home mortgage to pay off the balance owed on the house and then be a homeowner.