How to stop draft around pipe
Yes, it is always a good idea to fill any opening that may cause a draft. The opening isn't wide enough for the use of an expanding foam.
Instead any type of latex caulking will work as would any type of Spackle or plaster.
Use a putty knife (or similar) to press the material fully into the opening.
None of what ever fill you decide on will effect the gas pipe.