It is best to use library material, but if you cannot
If we assume that input lists are sorted (use List.sort or write your own):
let rec intersect ab = match a with |h::t -> match b with |h2::t2 -> if h=h2 then h::(intersect t t2) else if h>h2 then intersect tb else intersect a t2 |[] -> [] |[] -> []
source share