There are pens on the table. Some pens were brought by him.
Can "some pens" in the example refer to the pens on the table?
I would like to clarify if grammar allow such a construction in this case?
If you want to specifically convey that the person who brought the pens added them to the supply on the table, I'd say...
There are pens on the table. Some of the pens [or some of them - direct reference to the preceding sentence] were brought by him.
That would clarify exactly that there are two or more sources of pens, but the person indicated was responsible for at least some of those present on the table.
Otherwise, there could be the unintended meaning of...
There are pens on the table. Some pens were brought by him. He wasted his time because we already have pens.
Yes, absolutely. "Some pens" can be referred to the pens on the table. Take another example, "There is food on the table. Some food was brought by him" (i.e. he did bring some food too). Other than that context will solve most of the issue.
You could make that much better by saying: "There are some pens on the table and he brought some of them"