He must have been in the 4th Battalion to have that number. However if he later transferred to either the 5th Bn, 6th Bn or 7thBn he would have retained his six-digit 4th Bn number. This was one of the changes as before March 1917 all four battalions - 4th, 5th, 6th and 7th - would each have had a man with number 6789 for example.
The 4th RWF had two battalions 1st/4th and 2nd/4th. If there are no other numbers on his medal card you can assume that he was conscripted into 2nd/4th and after training was posted to either 1st/5th, 1st/6th or 1st/7th who have the same movements.
In theory he could have served in 1st/4th in France, but I doubt that he would have been transferred from France to Palestine. More likely that he returned to the UK injured and was transferred to 5th, 6th or 7th after recovering.
If his service record has not survived you will never know when he transferred to 5th, 6th or 7th Bn for certain. If you have Ancestry and a few spare hours you can try searching for men with a close number 20138?, then 20137?, 20139? etc on the National Archives WW1 medal site. Look for uncommon names and search for the records of these men on Ancestry.
The war diaries of 5th, 6th or 7th RWF may say when reinforcements arrived. These are being put online now, and may already be available. I suspect it will be late 1917/early 1918.
Ken