Is sterility hereditary?
Yes, it can be. Such is the case in certain crossbreeds of animals, like mules. They are viable but sterile and mules cannot be bred with each other. In humans it isn't the most common, but it does happen.
That would be kind of hard to do, as far as I know.
No it is not. Unless it is a product of a hereditary disease, such as Endometriosis in women.