You are asking about corporal punishment which I am taking to mean physical punishment not designed to cause injury.
Is corporal punishment/discipline ever OK?
Yes, in one specific instance, see below.
Is corporal punishment/discipline from a parent to a child OK?
Yes, this is the only instance I can find in the Bible where physical punishment is permitted. Three times in Proverbs it is mentioned that this is a way to discipline children, in 22:15, 23:13 and 29:15. To take 23:13 as an example:
Withhold not discipline from the child; for if you strike and punish him with the [reedlike] rod, he will not die.
It is necessary to discipline children; God does it; see Proverbs 3:1 and Hebrews 12:6. That Hebrews passage goes on (v7-10) to show that parents should discipline their children just as God does.
However, if you are angry, you must be self-controlled (Galatians 5:22-23) or you yourself may sin (Ephesians 4:26); you may hit too hard, too many times or use physical punishment when it might not be appropriate in that case. Bear in mind that in the same passage (Ephesians 6:1-4) where children are reminded of the command to love their parents, fathers have this command:
Fathers, do not irritate and provoke your children to anger [do not exasperate them to resentment], but rear them [tenderly] in the training and discipline and the counsel and admonition of the Lord.
Is corporal punishment/discipline between a husband and his wife OK?
To me, this question misunderstands the Biblical relationship of a husband and wife.
First on the subject of adult-to-adult physical punishment. Jesus made a passing reference (Matthew 24:49) to this that clearly shows that this is a sin.
Now, regarding husbands and wives, let us start with Ephesians 5:25:
Husbands, love your wives, as Christ loved the church and gave Himself up for her.
What does it mean for a husband to love his wife? In the text below, try mentally substituting love with loving husbands in this well known text 1 Corinthians 13:4-8a):
Love endures long and is patient and kind; love never is envious nor boils over with jealousy, is not boastful or vainglorious, does not display itself haughtily.
It is not conceited (arrogant and inflated with pride); it is not rude (unmannerly) and does not act unbecomingly. Love (God’s love in us) does not insist on its own rights or its own way, for it is not self-seeking; it is not touchy or fretful or resentful; it takes no account of the evil done to it [it pays no attention to a suffered wrong].
It does not rejoice at injustice and unrighteousness, but rejoices when right and truth prevail.
Love bears up under anything and everything that comes, is ever ready to believe the best of every person, its hopes are fadeless under all circumstances, and it endures everything [without weakening].
Love never fails [never fades out or becomes obsolete or comes to an end].
So, if someone loves their wife, why would they sin by hitting her, even under the guise of discipline?
A wife is not to be treated like a child or a servant but loved as an equal: both men and women were together made in the image of God (Genesis 1:26-27). That is why I think this question misunderstands the heart of the Biblical relationship between a husband and a wife and what they were created to be. It is never right for a husband to strike his wife.
On the subject of creation, I will close with the words of the theologian Matthew Henry:
“Eve was not taken out of Adam's head to top him, neither out of his feet to be trampled on by him, but out of his side to be equal with him, under his arm to be protected by him, and near his heart to be loved by him.”
Footnote: the only physical beatings I can think of in the New Testament are directly or indirectly demonic: Matthew 27:27-30, Mark 5:5, Acts 19:16 and 2 Corinthians 6:4-6.