If it's okay to say, "...to ask him questions," then it should be okay to say, "to ask John questions."
I can't think of any reason a name could not be substituted for a corresponding object pronoun. (In your example sentence, the word her and an object of the verb ask.)
However, if the word her in a sentence is a possessive pronoun, you would need to use the possessive form of the name.
So, for example:
The detective said, "He wants to ask her more questions."
The corresponding names can be substituted however you'd like. These are all valid variants:
The detective said, "Paul wants to ask her more questions."
The detective said, "He wants to ask Jane more questions."
The detective said, "Paul wants to ask Jane more questions."
However, if her is being used as a possessive pronoun, the substitution won't work:
Her questions always vex him.
Here, the valid variants are:
Her questions always vex Paul.
Jane's questions always vex him.
Jane's questions always vex Paul.
I can see why this might be a little confusing for feminine pronouns in English. For masculine pronouns, English uses his (possesive) and him (object), but for feminine pronouns, English uses her and her. I'm guessing that might be why you wondered if it would be okay to make the change. After all, I if said:
We need to make sure we leave enough time to ask her questions.
the sentence is ambiguous. If we are asking Mary questions, we can say:
We need to make sure we leave enough time to ask Mary questions.
However, suppose we are conducting a hiring interview. Mary is a member of our company. She usually attends hiring interviews, but she is out of town this week, so she's left a sheet of paper with some questions she'd like the rest of the hiring board to ask. In that case, I would say:
We need to make sure we leave enough time to ask Mary's questions.
because in that case, Mary isn't the object of the verb ask, she's the owner of the noun questions.