All i know is that Port 0 has open drain output drivers so the pull-ups must be provided externally.
Ports 1, 2, and 3 have built in internal pull-ups.
But my question is why only 10k ohm resistors are to be used why not some other value?
10k is a good standard, but not the only possible value. According to DC specifications of CMOS 8051, a range of 1.5 - 100 k would be feasible. The decision depends on the connected periperals and e.g. intended operation speed.