This can be done by adding two seperate rules to the text box that you are using. I've noticed this only works if the text box is set to a String type and not for Integer type text boxes. At least this is the case in Infopath 2007
Rule 1: Condition - If field1 matches the pattern \d (this means one integer)
Action: Set field1's value to this expression - concat("00",/my:myFields/my:field1)
Rule 2: Condition - If field1 matches the pattern \d\d (this means two integers)
Action: Set field1's value to this expression - concat("0",/my:myFields/my:field1)
I've attached a sample form that will do this for you. I also added some data validation to the field to ensure there cannot be more that three numbers in the field.