If a fielder touches the boundary or steps outside the boundary but comes back inside the field of play when he actually fields the ball, will a boundary be awarded to the batting team? i.e. contact with ball was made with the fielder well inside the field of play, but before that the fielder had touched the boundary.
Not a boundary - see Law 19.3(a):
A boundary shall be scored [...] whenever, while the ball is in play, [...]
(i) the ball touches the boundary, or is grounded beyond the boundary.
(ii) a fielder with some part of his person in contact with the ball, touches the boundary or has some part of his person grounded beyond the boundary.
(iii) the ball, having crossed the boundary in the air, is first touched by a fielder who has not satisfied the conditions in 4(i) below.
Section 4(i) is the requirement that a fielder cannot jump from beyond the boundary to make the first touch on a ball.
The crucial part here is clause (ii) which makes reference only to the current position of the fielder, not any previous position; therefore it doesn't matter what they may have done before the catch is made, it's only where they're positioned while the catch is being made.